Skip to content

Commit

Permalink
test unified user image
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Oct 15, 2023
1 parent c15c2ae commit 76b2ab8
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/docker_bullseye_target_unified.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Test Install Scripts Target Unified

on:
# schedule:
# # run at 5 every sunday
# - cron: '0 5 * * 0'
push:
branches-ignore:
- 'future3/**'
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ develop ]
workflow_dispatch:

env:
DOCKER_IMAGE_NAME: rpi-jukebox-rfid-bullseye
CACHE_SCOPE: ${{ github.ref_name }}-target-unified


jobs:
prepare:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Build Bullseye ARMv7
uses: docker/build-push-action@v5
with:
context: .
load: true
push: false
file: ./ci/unifiedDockerfile.bullseye.test_target_unified_install.armv7
target: user
platforms: linux/arm/v7
tags: local/${{ env.DOCKER_IMAGE_NAME }}-user:cache
cache-from: type=gha,scope=${{ env.CACHE_SCOPE }}
cache-to: type=gha,mode=max,scope=${{ env.CACHE_SCOPE }}


test:
needs: prepare
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
test_Script: [run_installation_tests.sh, run_installation_tests2.sh, run_installation_tests3.sh]
username: [pi, hans]

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Build Bullseye ARMv7
uses: docker/build-push-action@v5
with:
context: .
load: true
push: false
file: ./ci/unifiedDockerfile.bullseye.test_target_unified_install.armv7
target: test
platforms: linux/arm/v7
tags: local/${{ env.DOCKER_IMAGE_NAME }}-test:cache
cache-from: type=gha,scope=${{ env.CACHE_SCOPE }}
build-args: |
GIT_BRANCH=${{ github.ref_name }}
GIT_URL=${{ github.server_url }}/${{ github.repository }}
- name: Run ${{ matrix.test_Script }} Bullseye ARMv7
uses: tj-actions/docker-run@v2
with:
image: local/${{ env.DOCKER_IMAGE_NAME }}-test:cache
options: |
--platform linux/arm/v7
--user ${{ matrix.username }}
name: ${{ matrix.test_Script }}
args: |
./${{ matrix.test_Script }}
69 changes: 69 additions & 0 deletions ci/Dockerfile.bullseye.test_target_unified_install.armv7
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM --platform=linux/arm/v7 arm32v7/debian:bullseye-slim as base

# Define constants
ENV DOCKER_RUNNING=true
ENV DEBIAN_FRONTEND=noninteractive
RUN touch /boot/cmdlinetxt

# Install packages
RUN apt-get update && \
apt-get -y install \
apt-utils \
curl \
gnupg

RUN echo 'deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi' > /etc/apt/sources.list.d/raspi.list ;\
echo 'deb http://archive.raspberrypi.org/debian/ bullseye main' >> /etc/apt/sources.list.d/raspi.list ;\
curl http://raspbian.raspberrypi.org/raspbian.public.key | apt-key add - ;\
curl http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add - ;\
apt-get update && \
apt-get -y install \
build-essential \
git \
iw \
locales \
# install here to speed up GitHub Action
raspberrypi-kernel-headers \
sudo \
systemd \
wget \
wpasupplicant ;\
rm -rf /var/lib/apt/lists/*


FROM base as user
# Define user info
# ARG USER_NAME=pi
# ARG USER_GROUP=$USER_NAME

# ENV USER=$USER_NAME

RUN export USER=pi \
export USER_GROUP=$USER \
groupadd --gid 1000 $USER_GROUP && \
useradd -u 1000 -g 1000 -G sudo -d /home/$USER -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER && \
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER

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


FROM user as test
# Define Git Repo variables for installationscript.
ARG GIT_BRANCH
ARG GIT_URL

ENV GIT_BRANCH=$GIT_BRANCH GIT_URL=$GIT_URL

# Define needed files for installation test
COPY --chown=root:$USER_GROUP --chmod=770 scripts/installscripts/tests/*.sh /tests/
COPY --chown=root:$USER_GROUP --chmod=770 scripts/installscripts/buster-install-default.sh /

WORKDIR /tests


FROM test as test-update
RUN sudo apt-get update && sudo apt-get upgrade

0 comments on commit 76b2ab8

Please sign in to comment.