Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Commit fd487c1

Browse files
authored
Merge pull request #34 from fullstack-devops/bugfix/new-ng-cli-karma
init flavours golang and ng-cli-karma
2 parents 61d5df5 + 801651b commit fd487c1

File tree

10 files changed

+183
-3
lines changed

10 files changed

+183
-3
lines changed

.github/workflows/build-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
needs: [generate_infos, build_base]
7474
strategy:
7575
matrix:
76-
flavor: [ansible-k8s, maven-adopt-8-ng, maven-temurin-11, fullstacked]
76+
flavor: [ansible-k8s, maven-adopt-8-ng, maven-temurin-11, golang, ng-cli-karma, fullstacked]
7777
steps:
7878
- name: Check out the repo
7979
uses: actions/checkout@v2

.github/workflows/cleanup-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
strategy:
3232
matrix:
33-
flavor: [ansible-k8s, maven-adopt-8-ng, maven-temurin-11, fullstacked]
33+
flavor: [ansible-k8s, maven-adopt-8-ng, maven-temurin-11, golang, ng-cli-karma, fullstacked]
3434
steps:
3535
- name: Delete github-actions-runner:${{ matrix.flavor }}
3636
uses: bots-house/[email protected]

.github/workflows/create-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
needs: [create_release, build_base]
9898
strategy:
9999
matrix:
100-
flavor: [ansible-k8s, maven-adopt-8-ng, maven-temurin-11, fullstacked]
100+
flavor: [ansible-k8s, maven-adopt-8-ng, maven-temurin-11, golang, ng-cli-karma, fullstacked]
101101
steps:
102102
- name: Check out the repo
103103
uses: actions/checkout@v2

images/golang/Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM ghcr.io/fullstack-devops/github-actions-runner:latest-base
2+
3+
USER root
4+
# install packages along with jq so we can parse JSON
5+
# add additional packages as necessary
6+
ARG PACKAGES="nodejs ansible"
7+
ARG PACKAGES_PYTHON="kubernetes"
8+
9+
## ansible keys
10+
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add -
11+
RUN echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
12+
13+
RUN apt-get update \
14+
&& add-apt-repository -y --update ppa:ansible/ansible \
15+
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
16+
&& apt-get install -y --no-install-recommends ${PACKAGES} \
17+
&& rm -rf /var/lib/apt/lists/* \
18+
&& apt-get clean
19+
20+
ENV GH_RUNNER_LABELS="ubuntu-20.04,nodejs,go,golang,helm,ansible"
21+
# https://github.com/helm/helm/releases
22+
ARG HELM_VERSION=3.8.1
23+
# https://go.dev/dl/
24+
ARG GO_VERSION=1.18
25+
26+
# Install helm
27+
RUN export ARCH=$(/helper-scripts/translate-aarch.sh a-short) \
28+
&& wget -q https://get.helm.sh/helm-v${HELM_VERSION}-linux-${ARCH}.tar.gz -O - | tar -xzO linux-${ARCH}/helm > /usr/local/bin/helm \
29+
&& chmod +x /usr/local/bin/helm
30+
31+
# install build tools for golang
32+
RUN export ARCH=$(/helper-scripts/translate-aarch.sh a-short) \
33+
&& wget https://golang.org/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz -O /usr/local/src/go.linux.tar.gz \
34+
&& tar -xf /usr/local/src/go.linux.tar.gz \
35+
&& rm -rf /usr/local/src/go.linux.tar.gz \
36+
&& ln -s /usr/local/src/go/bin/go /usr/local/bin/
37+
38+
ENV TMP_DIR=/home/${USERNAME}/tmp
39+
40+
RUN mkdir /run/user/$USERID \
41+
&& mkdir /home/${USERNAME}/.ansible \
42+
&& mkdir ${TMP_DIR}
43+
44+
COPY requirements.yml ${TMP_DIR}/requirements.yml
45+
46+
RUN chown -R $USERNAME /home/$USERNAME \
47+
&& chown -R $USERNAME /run/user/$USERID
48+
49+
USER $USERNAME
50+
51+
RUN pip3 install $PACKAGES_PYTHON --user
52+
53+
# RUN ansible-galaxy install -c -r ${TMP_DIR}/requirements.yml
54+
RUN ansible-galaxy collection install -c -r ${TMP_DIR}/requirements.yml
55+
56+
# install helm plugins helm push, appr && diff
57+
RUN helm plugin install --version 0.10.2 https://github.com/chartmuseum/helm-push.git \
58+
&& helm plugin install --version 0.7.0 https://github.com/app-registry/appr-helm-plugin.git \
59+
&& helm plugin install --version 3.4.2 https://github.com/databus23/helm-diff

images/golang/requirements.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
collections:
3+
- name: kubernetes.core
4+
version: 2.3.1

images/ng-cli-karma/Dockerfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
FROM ghcr.io/fullstack-devops/github-actions-runner:latest-base
2+
3+
USER root
4+
# install packages along with jq so we can parse JSON
5+
# add additional packages as necessary
6+
ARG PACKAGES="nodejs ansible chromium python3-selenium xvfb"
7+
ARG PACKAGES_PYTHON="kubernetes"
8+
9+
## ansible keys
10+
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add -
11+
RUN echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
12+
13+
## helper for karma and chromium
14+
ENV CHROME_BIN="/usr/bin/chromium"
15+
ADD xvfb-chromium /usr/bin/xvfb-chromium
16+
ADD xvfb-chromium-webgl /usr/bin/xvfb-chromium-webgl
17+
ADD display-chromium /usr/bin/display-chromium
18+
19+
RUN chmod +x /usr/bin/display-chromium /usr/bin/xvfb-chromium-webgl /usr/bin/xvfb-chromium
20+
21+
RUN apt-get update \
22+
&& add-apt-repository -y --update ppa:ansible/ansible \
23+
&& add-apt-repository -y --update ppa:xtradeb/apps \
24+
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
25+
&& apt-get install -y --no-install-recommends ${PACKAGES} \
26+
&& rm -rf /var/lib/apt/lists/* \
27+
&& apt-get clean
28+
29+
ENV GH_RUNNER_LABELS="ubuntu-20.04,nodejs,yarn,karma,chrome,helm,ansible"
30+
# https://github.com/helm/helm/releases
31+
ARG HELM_VERSION=3.8.1
32+
# https://go.dev/dl/
33+
ARG GO_VERSION=1.18
34+
35+
# Install helm
36+
RUN export ARCH=$(/helper-scripts/translate-aarch.sh a-short) \
37+
&& wget -q https://get.helm.sh/helm-v${HELM_VERSION}-linux-${ARCH}.tar.gz -O - | tar -xzO linux-${ARCH}/helm > /usr/local/bin/helm \
38+
&& chmod +x /usr/local/bin/helm
39+
40+
ENV TMP_DIR=/home/${USERNAME}/tmp
41+
42+
RUN mkdir /run/user/$USERID \
43+
&& mkdir /home/${USERNAME}/.ansible \
44+
&& mkdir ${TMP_DIR}
45+
46+
COPY requirements.yml ${TMP_DIR}/requirements.yml
47+
48+
RUN chown -R $USERNAME /home/$USERNAME \
49+
&& chown -R $USERNAME /run/user/$USERID
50+
51+
# install npm tools: yarn
52+
ENV NPM_CONFIG_LOGLEVEL=warn NG_CLI_ANALYTICS=false
53+
RUN npm install --location=global yarn pnpm @angular/cli@14 \
54+
&& npm cache clean --force
55+
56+
USER $USERNAME
57+
58+
RUN pip3 install $PACKAGES_PYTHON --user
59+
60+
# RUN ansible-galaxy install -c -r ${TMP_DIR}/requirements.yml
61+
RUN ansible-galaxy collection install -c -r ${TMP_DIR}/requirements.yml
62+
63+
# install helm plugins helm push, appr && diff
64+
RUN helm plugin install --version 0.10.2 https://github.com/chartmuseum/helm-push.git \
65+
&& helm plugin install --version 0.7.0 https://github.com/app-registry/appr-helm-plugin.git \
66+
&& helm plugin install --version 3.4.2 https://github.com/databus23/helm-diff
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
$CHROME_BIN --disable-dev-shm-usage --no-sandbox --no-first-run $@
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
collections:
3+
- name: kubernetes.core
4+
version: 2.3.1

images/ng-cli-karma/xvfb-chromium

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
find_free_servernum() {
4+
i=0
5+
while [ -f /tmp/.X$i-lock ]; do
6+
i=$(($i + 1))
7+
done
8+
echo $i
9+
}
10+
11+
export DISPLAY=":$(find_free_servernum)"
12+
Xvfb "$DISPLAY" -ac -screen 0 "${XVFB_WHD:-1280x720x16}" -nolisten tcp +render &
13+
xvfb_pid=$!
14+
15+
echo "(wrapper:) launching with: $@"
16+
17+
function cleanup {
18+
kill -TERM $xvfb_pid > /dev/null 2>&1
19+
}
20+
21+
trap cleanup EXIT
22+
23+
$CHROME_BIN --disable-dev-shm-usage --no-sandbox --disable-gpu --no-first-run $@
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
find_free_servernum() {
4+
i=0
5+
while [ -f /tmp/.X$i-lock ]; do
6+
i=$(($i + 1))
7+
done
8+
echo $i
9+
}
10+
11+
export DISPLAY=":$(find_free_servernum)"
12+
Xvfb "$DISPLAY" -ac -screen 0 "${XVFB_WHD:-1280x800x16}" -nolisten tcp +render &
13+
xvfb_pid=$!
14+
15+
function cleanup {
16+
kill -TERM $xvfb_pid > /dev/null 2>&1
17+
}
18+
19+
trap cleanup EXIT
20+
21+
$CHROME_BIN --no-sandbox --no-first-run --use-gl=osmesa --enable-webgl --ignore-gpu-blacklist --window-size=1024,768 $@

0 commit comments

Comments
 (0)