Skip to content

Commit

Permalink
change testuser in workflow and container
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Dec 2, 2023
1 parent 1dad4e5 commit 9ffbb25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/test_docker_debian_codename_sub_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
type: string
default: ubuntu-latest

env:
TEST_USER_NAME: hans
TEST_USER_GROUP: wurst

# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
concurrency:
Expand Down Expand Up @@ -101,6 +105,8 @@ jobs:
cache-to: type=gha,mode=max,scope=${{ steps.vars.outputs.cache_scope }}
build-args: |
DEBIAN_CODENAME=${{ inputs.debian_codename }}
USER_NAME=${{ env.TEST_USER_NAME }}
USER_GROUP=${{ env.TEST_USER_GROUP }}
GIT_BRANCH=${{ github.head_ref || github.ref_name }}
GIT_USER=${{ github.event.pull_request.head.user.login || github.repository_owner }}
Expand Down Expand Up @@ -137,7 +143,6 @@ jobs:
strategy:
fail-fast: false
matrix:
username: ['hans']
test_script: ['run_install_common.sh', 'run_install_faststartup.sh', 'run_install_webapp_local.sh', 'run_install_webapp_download.sh']

steps:
Expand All @@ -157,11 +162,11 @@ jobs:
docker load --input ${{ needs.build.outputs.image_file_name }}
# Run test
- name: Run Test ${{ inputs.debian_codename }}-${{ matrix.username }}-${{ matrix.test_script }}
- name: Run Test ${{ inputs.debian_codename }}-${{ env.TEST_USER_NAME }}-${{ matrix.test_script }}
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{ inputs.platform }} --user ${{ matrix.username }} --init
options: --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
Expand Down
16 changes: 2 additions & 14 deletions ci/ci-debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ RUN echo "--- install packages (1) ---" \
RUN echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
# ------

# Base Target for setting up the default user. user can be selected with the docker '--user YYY' option
FROM base as user
# Base Target for setting up a test user. user can be selected with the docker '--user YYY' option
FROM base as test-user
ARG USER_NAME=pi
ARG USER_GROUP=$USER_NAME
ARG USER_ID=1000
Expand All @@ -56,18 +56,6 @@ RUN groupadd --gid 1000 $USER_GROUP \
ENV XDG_RUNTIME_DIR=/run/user/$USER_ID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$USER_ID/bus
# ------


# Target for setting up an alternativ user 'hans:wurst'. user can be selected with the docker '--user YYY' option
FROM user as test-user

RUN export USER_ALT=hans \
&& export USER_ALT_GROUP=wurst \
&& groupadd --gid 1001 $USER_ALT_GROUP \
&& useradd -u 1001 -g $USER_ALT_GROUP -G sudo,$TEST_USER_GROUP -d /home/$USER_ALT -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER_ALT \
&& echo "$USER_ALT ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER_ALT
# ------


# Target for adding envs and scripts from the repo to test installation
FROM test-user as test-code
ARG GIT_BRANCH
Expand Down

0 comments on commit 9ffbb25

Please sign in to comment.