On Thu, Dec 5, 2024 at 6:12 AM Khem Raj <[email protected]> wrote:
>
> On Wed, Dec 4, 2024 at 1:14 AM Ankur Tyagi via lists.openembedded.org
> <[email protected]> wrote:
> >
> > Hello,
> >
> > I am trying to use github workflow to build core-image-minimal (scarthgap) 
> > inside a docker container (ghcr.io/crops/poky:ubuntu-22.04)
> >
> > Following is the workflow step:
> >
> >
> > steps:
> > - name: Start Yocto image build
> > shell: bash
> >
> > run: |
> > echo "${{ secrets.TRACKER_TOKEN }}" | docker login ghcr.io -u ${{ 
> > github.actor }} --password-stdin
> > docker pull ghcr.io/crops/poky:ubuntu-22.04
> >
> > cat << 'EOF' > script.sh
> > #!/bin/bash
> > echo "Running inside the Docker container"
> > git clone git://git.yoctoproject.org/poky -b scarthgap
> > source oe-init-build-env
> > bitbake core-image-minimal
> > EOF
> >
> > chmod +x script.sh
> > docker run --rm -v $(pwd):/yocto --workdir=/workdir 
> > ghcr.io/crops/poky:ubuntu-22.04 /bin/bash -c "source /workdir/script.sh"
>
> its possible that its executing in a fresh shell which is not
> inheriting the environment. Maybe try to run steps outside the script.

Thanks for your reply.

Using a new shell for the script is understandable but I don't understand
how a fresh shell can be used to execute part of the script.

I still tried your suggestion and a few other things like
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idcontainer
but no success.

Instead of using docker run, noticed that the github workflow uses
docker create and docker start (which is good)
and also override the entrypoint. I am yet to figure out if that is the reason.

But in the end, I worked-around the problem by self-hosting the runner
and it is working now.

>
> >
> >
> > But I am getting following error when this step runs:
> >
> > WARNING: bitbake binary is not found in PATH, did you source the script?
> > ERROR: Execution of event handler 'defaultcheck_sanity_eventhandler' failed
> > Traceback (most recent call last):
> > File "/workdir/poky/meta/classes-global/sanity.bbclass", line 1025, in 
> > defaultcheck_sanity_eventhandler(e=<bb.event.SanityCheck object at 
> > 0x7f7495a4cca0>, d=<bb.data_smart.DataSmart object at 0x7f74959d6a40>):
> > sanity_data = bb.data.createCopy(e.data)
> > > check_sanity(sanity_data)
> > if e.generateevents:
> > File "/workdir/poky/meta/classes-global/sanity.bbclass", line 996, in 
> > check_sanity(sanity_data=<bb.data_smart.DataSmart object at 
> > 0x7f7495a4cf10>):
> > if last_sanity_version < sanity_version or last_nativelsbstr != 
> > nativelsbstr:
> > > check_sanity_version_change(status, sanity_data)
> > status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
> > File "/workdir/poky/meta/classes-global/sanity.bbclass", line 702, in 
> > check_sanity_version_change(status=<SanityStatus object at 0x7f7495a4db10>, 
> > d=<bb.data_smart.DataSmart object at 0x7f7495a4cf10>):
> > for bin_cmd in suid_check_bins:
> > > bin_path = bb.utils.which(os.environ["PATH"], bin_cmd)
> > if bin_path:
> > File "/usr/lib/python3.10/os.py", line 680, in 
> > _Environ.__getitem__(key='PATH'):
> > # raise KeyError with the original key value
> > > raise KeyError(key) from None
> > return self.decodevalue(value)
> > KeyError: 'PATH'
> > ERROR: Command execution failed: Traceback (most recent call last):
> > File "/workdir/poky/bitbake/lib/bb/command.py", line 122, in runAsyncCommand
> > self.cooker.updateCache()
> > File "/workdir/poky/bitbake/lib/bb/cooker.py", line 1606, in updateCache
> > bb.event.fire(bb.event.SanityCheck(False), self.databuilder.mcdata[mc])
> > File "/workdir/poky/bitbake/lib/bb/event.py", line 225, in fire
> > fire_class_handlers(event, d)
> > File "/workdir/poky/bitbake/lib/bb/event.py", line 132, in 
> > fire_class_handlers
> > execute_handler(name, handler, event, d)
> > File "/workdir/poky/bitbake/lib/bb/event.py", line 103, in execute_handler
> > ret = handler(event, d)
> > File "/workdir/poky/meta/classes-global/sanity.bbclass", line 1025, in 
> > defaultcheck_sanity_eventhandler
> > check_sanity(sanity_data)
> > File "/workdir/poky/meta/classes-global/sanity.bbclass", line 996, in 
> > check_sanity
> > check_sanity_version_change(status, sanity_data)
> > File "/workdir/poky/meta/classes-global/sanity.bbclass", line 702, in 
> > check_sanity_version_change
> > bin_path = bb.utils.which(os.environ["PATH"], bin_cmd)
> > File "/usr/lib/python3.10/os.py", line 680, in __getitem__
> > raise KeyError(key) from None
> > KeyError: 'PATH'
> > Summary: There was 1 WARNING message.
> > Summary: There were 2 ERROR messages, returning a non-zero exit code.
> >
> > I have confirmed by adding "echo $PATH" before image starts that PATH 
> > environment variable exists and bitbake is in the path:
> >
> > /workdir/poky/scripts:/workdir/poky/bitbake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> >
> >
> > But if I run the step as it is in my host machine, docker container is able 
> > to build the image.
> >
> > Any suggestions on what could be wrong here?
> >
> > thanks
> > Ankur
> >
> >
> > 
> >
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#114201): 
https://lists.openembedded.org/g/openembedded-devel/message/114201
Mute This Topic: https://lists.openembedded.org/mt/109916860/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to