-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCB - docker-in-docker build #202
Conversation
echo " -wd: select working directory for docker mount to /workdir" | ||
echo " Pass the directory explicitly for docker run torizon/torizoncore-builder" | ||
echo " to mount as /workdir." | ||
echo " It must be an absolute directory. If this is not set, \$(pwd) with be used" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(pwd) with be used
I think this was a typo with
should be will
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes ..will be used
sh get-docker.sh | ||
|
||
wget -nv https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell_7.4.2-1.deb_amd64.deb | ||
dpkg -i powershell_7.4.2-1.deb_amd64.deb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, maybe this is needed on your end because you host your own runner. But, on Github Actions the default image already has these dependencies.
Would be nice to first identify whether the dependencies are already installed before installing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed because I'm running the build inside a container, on the shared and self-hosted runners. Both will spin up a docker Ubuntu:23.04 container, mount the local filesystem, and run the build commands. It's good for reproducibility. If you used GitLab, running dind is standard.
@@ -6,13 +6,18 @@ jobs: | |||
build-deploy: | |||
runs-on: ubuntu-latest | |||
name: Build & Deploy TorizonCore | |||
container: ubuntu:23.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed because of the self-hosted runner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, see this post: https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container
@dk-coligo sorry for the delay, we are in the process of a new release, so, I will back to this after the release. We need to add it to our CI/CD integration tests to make sure that this will not break it the already existent experience. |
@microhobby we've had to make many other changes to the default scripts. For example, the platform-push stage for the tasks.json. In the developer documentation, there is a dependency on |
LGTM. I will rebase it here and include it in the next 2.6 release. Thanks for the contribution |
When running the tcb in a docker-in-docker environment, the workdir mount point is not found, because the github actions runner sandbox the runner by re-writing the absolute path to a different location. So, first we need to get the absolute path of the workspace and then store it in a file called abs-path, so we can use get the path from the file and use it as the workdir mount point. Reported-by: @dk-coligo Related-to: #202 Signed-off-by: Matheus Castello <matheus.castello@toradex.com>
@dk-coligo I reimplemented the stuff reported here, so instead of adding a |
The existing github actions does not function for a docker-in-docker (
dind
) configuration. Due to the build script using directories withroot:root
ownership a rootless self-hosted runner can not complete this workflow.The configuration below adds
-wd working_directory
argument to thetcb-env-setup.sh
script to allow absolute path to be passed directly to thedocker run torizon/torizoncore-builder
. Due to adind
setup, the/workdir
needs to be mounted with an absolute path. Github actions provides variables containing the absolute path for the runner directory, however, this is a well documented bug in the runner since 2022:A workaround for this is to add a build step creating a file with this abs-path to be referenced later
echo "${{ github.workspace }}" >> abs-path
. Any ENV var set in actions will be replaced at run-time by the runner replacing the ABS path with a relative sandboxed path for the runner. This is why a file is written, not an ENV.The
scripts/tasks.ps1
now has an additional ENV check to detect if it's in a Actions workflow, and set the abs-path accordingly. I did not handle errors for thisabs-path
file not existing.tcb-build
stage, no subsequent steps -tcb-platform-push-ostree
, orplatform-update-fleet
❗REF: email
Signed-off-by: d.kelly@coligo.ai