Skip to content

Commit 20206af

Browse files
committed
Further change for UID issue fix. Passing the UID & GID of host machine from GitHub action workflow.
1 parent be29d05 commit 20206af

File tree

7 files changed

+71
-32
lines changed

7 files changed

+71
-32
lines changed

.github/workflows/push-again.yml

+13
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ jobs:
4141
path: 'release'
4242
ref: ${{ github.event.inputs.release }}
4343

44+
- name: Get userUid from host machine
45+
id: get-useruid
46+
run: |
47+
set -e
48+
USER_UID=$(id -u)
49+
USER_GID=$(id -g)
50+
echo "UserUid::$USER_UID"
51+
echo "UserGid::$USER_GID"
52+
echo "USER_UID=$USER_UID" >> $GITHUB_ENV
53+
echo "USER_GID=$USER_GID" >> $GITHUB_ENV
54+
4455
- name: Build and push
4556
id: build_and_push
4657
env:
@@ -51,6 +62,8 @@ jobs:
5162
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
5263
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
5364
PASSWORD: ${{ secrets.PASSWORD }}
65+
USER_UID: ${{ env.USER_UID }}
66+
USER_GID: ${{ env.USER_GID }}
5467
run: |
5568
set -e
5669

.github/workflows/push-dev.yml

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ jobs:
3030
id: checkout
3131
uses: actions/checkout@v3
3232

33+
- name: Get userUid from host machine
34+
id: get-useruid
35+
run: |
36+
set -e
37+
USER_UID=$(id -u)
38+
USER_GID=$(id -g)
39+
echo "UserUid::$USER_UID"
40+
echo "UserGid::$USER_GID"
41+
echo "USER_UID=$USER_UID" >> $GITHUB_ENV
42+
echo "USER_GID=$USER_GID" >> $GITHUB_ENV
43+
3344
- name: Build and push dev tags
3445
id: build_and_push
3546
env:
@@ -41,6 +52,8 @@ jobs:
4152
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
4253
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
4354
PASSWORD: ${{ secrets.PASSWORD }}
55+
USER_UID: ${{ env.USER_UID }}
56+
USER_GID: ${{ env.USER_GID }}
4457
run: |
4558
set -e
4659

.github/workflows/push-manual-dev.yml

+13
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ jobs:
3737
path: 'release'
3838
ref: ${{ github.event.inputs.release }}
3939

40+
- name: Get userUid from host machine
41+
id: get-useruid
42+
run: |
43+
set -e
44+
USER_UID=$(id -u)
45+
USER_GID=$(id -g)
46+
echo "UserUid::$USER_UID"
47+
echo "UserGid::$USER_GID"
48+
echo "USER_UID=$USER_UID" >> $GITHUB_ENV
49+
echo "USER_GID=$USER_GID" >> $GITHUB_ENV
50+
4051
- name: Build and push
4152
id: build_and_push
4253
env:
@@ -47,6 +58,8 @@ jobs:
4758
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
4859
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
4960
PASSWORD: ${{ secrets.PASSWORD }}
61+
USER_UID: ${{ env.USER_UID }}
62+
USER_GID: ${{ env.USER_GID }}
5063
run: |
5164
set -e
5265

.github/workflows/push.yml

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ jobs:
3030
id: checkout
3131
uses: actions/checkout@v3
3232

33+
- name: Get userUid from host machine
34+
id: get-useruid
35+
run: |
36+
set -e
37+
USER_UID=$(id -u)
38+
USER_GID=$(id -g)
39+
echo "UserUid::$USER_UID"
40+
echo "UserGid::$USER_GID"
41+
echo "USER_UID=$USER_UID" >> $GITHUB_ENV
42+
echo "USER_GID=$USER_GID" >> $GITHUB_ENV
43+
3344
- name: Get tag name
3445
run: echo "TAG=$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')" >> $GITHUB_ENV
3546

@@ -44,6 +55,8 @@ jobs:
4455
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
4556
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
4657
PASSWORD: ${{ secrets.PASSWORD }}
58+
USER_UID: ${{ env.USER_UID }}
59+
USER_GID: ${{ env.USER_GID }}
4760
run: |
4861
set -e
4962

.github/workflows/smoke-universal.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,23 @@ jobs:
1919
- name: Checkout
2020
id: checkout
2121
uses: actions/checkout@v3
22+
23+
- name: Get userUid from host machine
24+
id: get-useruid
25+
run: |
26+
set -e
27+
USER_UID=$(id -u)
28+
USER_GID=$(id -g)
29+
echo "UserUid::$USER_UID"
30+
echo "UserGid::$USER_GID"
31+
echo "USER_UID=$USER_UID" >> $GITHUB_ENV
32+
echo "USER_GID=$USER_GID" >> $GITHUB_ENV
33+
2234
- name: Smoke test
2335
env:
2436
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
USER_UID: ${{ env.USER_UID }}
38+
USER_GID: ${{ env.USER_GID }}
2539
id: smoke_test
2640
uses: ./.github/actions/smoke-test
2741
with:

src/universal/.devcontainer/devcontainer.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
"features": {
77
"ghcr.io/devcontainers/features/common-utils:2": {
88
"username": "codespace",
9-
"userUid": "1000",
10-
"userGid": "1000"
9+
//Getting the UID & GID values of the host machine via GitHub actions
10+
//"userUid": "1000",
11+
//"userGid": "1000"
12+
"userUid": "${localEnv:USER_UID}",
13+
"userGid": "${localEnv:USER_GID}"
1114
},
1215
"ghcr.io/devcontainers/features/dotnet:2": {
1316
"version": "8.0",
@@ -108,7 +111,6 @@
108111
"remoteEnv": {
109112
"CHROME_DEVEL_SANDBOX": "/usr/local/sbin/chrome-devel-sandbox"
110113
},
111-
"postCreateCommand": "/usr/local/share/setup-user-priv.sh",
112114
// Use 'forwardPorts' to make a list of ports inside the container available locally.
113115
// "forwardPorts": [],
114116

src/universal/.devcontainer/local-features/setup-user/install.sh

-29
Original file line numberDiff line numberDiff line change
@@ -108,33 +108,4 @@ cp -p chrome-sandbox /usr/local/sbin/chrome-devel-sandbox
108108
cd /
109109
rm -f google-chrome-stable_current_amd64.deb
110110

111-
# --- Generate a 'pull-git-lfs-artifacts.sh' script to be executed by the 'postCreateCommand' lifecycle hook
112-
SETUP_USER_PRIV_SCRIPT_PATH="/usr/local/share/setup-user-priv.sh"
113-
114-
tee "$SETUP_USER_PRIV_SCRIPT_PATH" > /dev/null \
115-
<< EOF
116-
#!/bin/sh
117-
set -eux
118-
USERNAME="codespace"
119-
EOF
120-
121-
tee -a "$SETUP_USER_PRIV_SCRIPT_PATH" > /dev/null \
122-
<< 'EOF'
123-
124-
echo “Setting up the right privilege…”
125-
echo "Need to check the increased size.."
126-
sudo chown -R "${USERNAME}:${USERNAME}" /usr/share/dotnet
127-
sudo chmod g+r+w+s /usr/share/dotnet
128-
sudo chmod -R g+r+w /usr/share/dotnet
129-
130-
OPT_DIR="/opt/"
131-
sudo chown -R ${USERNAME}:oryx ${OPT_DIR}
132-
sudo chmod -R g+r+w "${OPT_DIR}"
133-
sudo find "${OPT_DIR}" -type d | xargs -n 1 chmod g+s
134-
135-
echo "Done!"
136-
EOF
137-
138-
chmod 755 "$SETUP_USER_PRIV_SCRIPT_PATH"
139-
140111
echo "Done!"

0 commit comments

Comments
 (0)