Skip to content
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

.github/workflows/compilers.yml: Specify a container running user as root. #4766

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

junaruga
Copy link
Member

@junaruga junaruga commented Aug 23, 2021

Coming new ruby/ruby-ci-image images are required to run the container as
a regular user by default, while the root user is required to run the
compilers.yml. Add id command to print the user info.

Co-authored-by: fedor fedor@cirruslabs.org


This PR is based on the PR: #4750 . I updated the commit message, and container image URL and added the id command. This PR is a preparation for the coming new images.

Note the new ruby/ruby-ci-image images are here.
ruby/ruby-ci-image#3

I tested this PR with both the current and coming container images too.

The newly added id command and current mkdir build command only work with working-directory: syntax. But doesn't work without the working-directory: syntax.

       - run: id
         working-directory:
       - run: mkdir build
         working-directory:

For example, the mkdir build without the working-directory: syntax prints the following error. I am not sure why the error happen. Anyway, I added the working-directory: to the commands.

https://github.com/junaruga/ruby/runs/3404442652?check_suite_focus=true#step:4:17

Run mkdir build
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: chdir to cwd ("/__w/ruby/ruby/build") set in config.json failed: no such file or directory: unknown
Error: Process completed with exit code 126.

…root.

Explicitly specify the root as a user to run tests in the containers.

Coming new ruby/ruby-ci-image images are required to run the container as
a regular user by default, while the root user is required to run the
compilers.yml. Add `id` command to print the user info.

Co-authored-by: fedor <fedor@cirruslabs.org>
@junaruga junaruga force-pushed the wip/ci-compilers-specify-user branch from e9a8f04 to c7f4919 Compare August 23, 2021 20:50
@junaruga junaruga changed the title Explicitly specify the root user to run tests in the containers. .github/workflows/compilers.yml: Specify a container running user as root. Aug 23, 2021
@nobu
Copy link
Member

nobu commented Aug 24, 2021

As the working-directory is set to build at the bottom of that file, any command can’t run without resetting it before the mkdir has done.

@junaruga
Copy link
Member Author

Ah I understood it now seeing the following bottom line of the file. Thanks for the explanation. When a command is executed without working-directory: before creating the build directory, the command is executed on the build directory but the build directory is still not created. So, we cannot run the command.

defaults:
  run:
    working-directory: build

@junaruga junaruga merged commit 2be84af into ruby:master Aug 24, 2021
@junaruga junaruga deleted the wip/ci-compilers-specify-user branch August 24, 2021 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants