-
Notifications
You must be signed in to change notification settings - Fork 750
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
[SYCL][Devops] Fix DockerFile
linting issues discovered by trivy
#16361
Changes from all commits
045e856
15a7c6a
10cc0e3
1ea04f5
49ab319
c0439ff
35a07f0
ed7171c
1ff5dd4
4d28c77
8530141
3d7c76f
3cb941a
6d88ec7
0964ce8
0625177
be4e0c6
ff333a1
8d931df
5d82571
4ef8161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [[ $# -eq 0 ]]; then | ||
# When launched without arguments, we assume that it was launched as part of | ||
# CI workflow and therefore a different kind of user is created | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i wonder if we can check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that all our containers are only for the purposes of CI and local development, I decided that they will all use Those, who need |
||
USER_NAME=sycl_ci | ||
SET_PASSWD=true | ||
|
||
# By default Ubuntu sets an arbitrary UID value, that is different from host | ||
# system. When CI passes default UID value of 1001, some of LLVM tools fail to | ||
# discover user home directory and fail a few LIT tests. Fixes UID and GID to | ||
# 1001, that is used as default by GitHub Actions. | ||
USER_ID=1001 | ||
else | ||
if [[ "${1:-}" != "--regular" ]]; then | ||
echo "The only supported argument is --regular!" | ||
exit 1 | ||
fi | ||
USER_NAME=sycl | ||
SET_PASSWD=false | ||
|
||
# Some user id which is different from the one assigned to sycl_ci user | ||
USER_ID=1234 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also sorry, you might have to rebase because i added a 24.04 oneapi docker image today There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
fi | ||
|
||
groupadd -g $USER_ID $USER_NAME && useradd $USER_NAME -u $USER_ID -g $USER_ID -m -s /bin/bash | ||
# Add user to video/irc groups so that it can access GPU | ||
usermod -aG video $USER_NAME | ||
usermod -aG irc $USER_NAME | ||
|
||
# group 109 is required for user to access PVC card. | ||
groupadd -f -g 109 render | ||
usermod -aG render $USER_NAME | ||
|
||
if [[ $SET_PASSWD == true ]]; then | ||
if [[ ! -f /run/secrets/sycl_ci_passwd ]]; then | ||
echo "Password is requested, but /run/secrets/sycl_ci_passwd doesn't exist!" | ||
exit 2 | ||
fi | ||
|
||
# Set password for user | ||
echo "$USER_NAME:$(cat /run/secrets/sycl_ci_passwd)" | chpasswd | ||
|
||
# Allow user to run as sudo, but only with password | ||
echo "$USER_NAME ALL=(ALL) PASSWD:ALL" >> /etc/sudoers | ||
else | ||
echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
#!/bin/bash | ||
|
||
if [ -d "$GITHUB_WORKSPACE" ]; then | ||
chown -R sycl:sycl $GITHUB_WORKSPACE | ||
su sycl | ||
fi | ||
|
||
exec "$@" |
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.
do we need parens here?
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.
From my local experiments:
So, it seems to work correctly, but I can add parens for clarity if that's a preference