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

fix(ci) fixing the file permission issue for CI runner #8311

Merged
merged 5 commits into from
Sep 17, 2022

Conversation

skrdgraph
Copy link
Contributor

@skrdgraph skrdgraph commented Sep 17, 2022

Problem

The previous fixes were introducing a cleanup step in our CI, which is not ideal & it is not consistent either - because any files created from within the container cannot be cleaned up by other steps because of root user issues. Docker runs as root.

Solution

The correct fix is to have the runner run as root, which is the ideal way of dealing with this. There are security concerns here, but I have looked further to ensure we are not impacted. This change is made in this PR. The earlier PRs #8307 #8301 & issues actions/checkout#211 Gamify-IT/issues#60 talk about the fixes.

@skrdgraph
Copy link
Contributor Author

fyi @joshua-goldstein @dshekhar95 we should have fixed it this way. We should try to avoid adding too many cleanups to the CI steps (as they should mimic & control out test flow, NOT infrastructure cleaning or setup).

I have put the correct fix towards the runner infrastructure. We can discuss next week - but pls do look to understand these changes.

Comment on lines -12 to -19
#TODO: WE NEED TO REMOVE THIS CLEANUP, and handle it more elegantly, it makes us incompatible with gh-hosted-runners
cleanup:
runs-on: self-hosted
container:
image: ubuntu:latest
steps:
- name: Cleaning up the $GITHUB_WORKSPACE as root from a Docker image
run: find /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/. -name . -o -prune -exec rm -rf -- {} + || true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshua-goldstein & @dshekhar95 this won't be needed anymore because of the fix in the infrastructure layer

Comment on lines -12 to -19
#TODO: WE NEED TO REMOVE THIS CLEANUP, and handle it more elegantly, it makes us incompatible with gh-hosted-runners
cleanup:
runs-on: self-hosted
container:
image: ubuntu:latest
steps:
- name: Cleaning up the $GITHUB_WORKSPACE as root from a Docker image
run: find /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/. -name . -o -prune -exec rm -rf -- {} + || true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshua-goldstein & @dshekhar95 this won't be needed anymore because of the fix in the infrastructure layer

@@ -26,6 +26,7 @@ curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/ru
echo "34a8f34956cdacd2156d4c658cce8dd54c5aef316a16bbbc95eb3ca4fd76429a actions-runner-linux-x64-2.296.2.tar.gz" | shasum -a 256 -c
tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz
./config.sh --url https://github.com/dgraph-io/dgraph --token $TOKEN
sudo chown -R $USER:$USER /home/ubuntu/actions-runner/_work # fixes the test cruft cleanup issue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshua-goldstein @dshekhar95 this is the correct way to fix it at the infrastructure layer.

@skrdgraph skrdgraph marked this pull request as ready for review September 17, 2022 10:47
@skrdgraph skrdgraph changed the title fix(ci) fixing the file permission issue fix(ci) fixing the file permission issue for CI runner Sep 17, 2022
@skrdgraph skrdgraph merged commit ddee455 into main Sep 17, 2022
@skrdgraph skrdgraph deleted the skrdgraph/fix_ci_runner_cleanups branch September 17, 2022 10:47
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 37.099% when pulling 9785523 on skrdgraph/fix_ci_runner_cleanups into 0474f2b on main.

dshekhar95 pushed a commit that referenced this pull request Sep 19, 2022
* undo changes to dgraph tests

* undo changes to load tests

* fixing the runner user, to handle cruft cleanup issue

* fix test cruft issue

* fix test cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants