-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Change docker user to ec2-user (#2834)
Add back in an explicitly defined user in the docker build because I can't figure out which user is being used by the docker image. If a user other than ec2-user is being used, then it is not possibly for the next job to clean up files from previous jobs because it lacks permission. Should fix the problems like https://github.com/pytorch/tutorials/actions/runs/8635938916/job/23674817847 ``` Cleaning the repository Warning: Unable to clean or reset the repository. The repository will be recreated instead. Deleting the contents of '/home/ec2-user/actions-runner/_work/tutorials/tutorials' Error: File was unable to be removed Error: EACCES: permission denied, unlink '/home/ec2-user/actions-runner/_work/tutorials/tutorials/.jenkins/__pycache__/get_files_to_run.cpython-310.pyc' ```
- Loading branch information
Showing
5 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# Copied from https://github.com/pytorch/executorch/blob/6e431355a554e5f84c3a05dfa2b981ead90c2b48/.ci/docker/common/install_user.sh#L1 | ||
|
||
set -ex | ||
|
||
# Same as ec2-user | ||
echo "ci-user:x:1000:1000::/var/lib/ci-user:" >> /etc/passwd | ||
echo "ci-user:x:1000:" >> /etc/group | ||
# Needed on Focal or newer | ||
echo "ci-user:*:19110:0:99999:7:::" >> /etc/shadow | ||
|
||
# Create $HOME | ||
mkdir -p /var/lib/ci-user | ||
chown ci-user:ci-user /var/lib/ci-user | ||
|
||
# Allow sudo | ||
echo 'ci-user ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ci-user | ||
|
||
# Test that sudo works | ||
sudo -u ci-user sudo -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters