Skip to content

Commit

Permalink
Adapt smoke test job configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
danroux committed Apr 26, 2024
1 parent 2eb38df commit 992fe38
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 62 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ updates:
prefix: "npm deps:"
include: "scope"
open-pull-requests-limit: 10
assignees:
reviewers:
- "danroux"
- package-ecosystem: "github-actions"
directory: "/"
Expand All @@ -28,7 +28,7 @@ updates:
prefix: "gha deps:"
include: "scope"
open-pull-requests-limit: 10
assignees:
reviewers:
- "danroux"
- package-ecosystem: "docker"
directory: "/"
Expand All @@ -43,5 +43,5 @@ updates:
prefix: "docker deps:"
include: "scope"
open-pull-requests-limit: 10
assignees:
reviewers:
- "danroux"
4 changes: 2 additions & 2 deletions .github/workflows/.dependabot_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ jobs:
git config --local user.email "dependabot[bot]@users.noreply.github.com"
git config --local user.name "dependabot[bot]"
git add .changelog
git commit -m "Add .changelog entry #${{ github.event.pull_request.number }}"
git push "https://x-access-token:$GITHUB_TOKEN@github.com/${{ github.repository }}.git" HEAD:${{ github.event.pull_request.head.ref }}
git commit --amend --no-edit
git push --force "https://x-access-token:$GITHUB_TOKEN@github.com/${{ github.repository }}.git" HEAD:${{ github.event.pull_request.head.ref }}
39 changes: 33 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Build & Push images

on:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
Expand Down Expand Up @@ -30,7 +29,7 @@ jobs:
sk8l-ui-dev-img:
runs-on: ubuntu-latest
name: sk8l-ui:dev-${{ inputs.image_tag }}
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand All @@ -55,10 +54,38 @@ jobs:
cache-to: type=gha,mode=max
push: true
tags: |
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ github.sha }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ inputs.image_tag }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ inputs.pull_request_number }}
sk8l-ui-dev-main-img:
runs-on: ubuntu-latest
name: sk8l-ui:dev-main@${{ github.sha }}
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Login to ghcr.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push dev version
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: .
file: Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ github.sha }}
sk8l-ui-pre-main-img:
runs-on: ubuntu-latest
name: sk8l-ui:pre-main@${{ github.sha }}
Expand Down Expand Up @@ -92,7 +119,7 @@ jobs:
sk8l-ui-pre-pr-img:
runs-on: ubuntu-latest
name: sk8l-ui:pre-${{ inputs.image_tag }}
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down Expand Up @@ -150,7 +177,7 @@ jobs:
runs-on: ubuntu-latest
name: sk8l-ui:ui-test-${{ inputs.image_tag }}
needs: [sk8l-ui-pre-pr-img]
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'workflow_call' && inputs.image_tag || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/k8s-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: ui smoke tests
id: ui_smoke_tests
run: |
./ci/ui_smoke_tests.sh
./ci/ui_smoke_tests.sh ghcr.io/danroux/sk8l-ui:ui-test-${{ inputs.image_tag }}
- name: ui smoke tests error output
if: ${{ failure() && steps.ui_smoke_tests.conclusion == 'failure' }}
run: |
Expand Down
15 changes: 15 additions & 0 deletions ci/ui_smoke_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@

set -e

pr_image_tag="$1"

kubectl apply -f https://raw.githubusercontent.com/danroux/sk8l-api/main/testdata/sk8l-cronjobs.yml -n sk8l > /dev/null
kubectl wait -n sk8l --for=condition=ready pod -l app.kubernetes.io/pod=sk8l-ui --timeout=300s
sleep 10
cp testdata/cypress-job.yml testdata/cypress-job.yml.bak
yq e -i ".spec.template.spec.containers[0].image = \"$pr_image_tag\"" testdata/cypress-job.yml

set +e
echo "after"
diff -C3 testdata/cypress-job.yml.bak testdata/cypress-job.yml
diff_status=$?
set -e
if [ $diff_status -eq 0 ]; then
echo "No differences found between the files."
exit 1
fi

kubectl apply -f testdata/cypress-job.yml -n sk8l
kubectl wait --for=condition=complete job.batch/cypress-job -n sk8l --timeout=600s

Expand Down
92 changes: 42 additions & 50 deletions testdata/cypress-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,29 @@ spec:
template:
spec:
containers:
- name: cypress
image: ghcr.io/danroux/sk8l-ui:ui-test
imagePullPolicy: Always
command: [
"cypress"
]
args: [
"run",
"--browser",
"firefox:stable",
"--headless",
"--config-file=cypress.config.ts"
]
# command: ["/bin/sh"]
# args: ["-c", "while true; do echo hello; sleep 120;done"]
workingDir: /e2e
volumeMounts:
- name: tls-certs
mountPath: /e2e/testdata/sk8l-certs
readOnly: true
- name: xapp
mountPath: /e2e/cypress/screenshots
- name: ca-certificate-only
mountPath: /usr/lib/mozilla/certificates
readOnly: true
- name: ca-certificate-only
mountPath: /usr/lib64/mozilla/certificates
readOnly: true
- name: ca-certificate-only
mountPath: ~/.mozilla/certificates
readOnly: true
- name: cypress
image: ghcr.io/danroux/sk8l-ui:ui-test
imagePullPolicy: Always
command: ["cypress"]
args: ["run", "--browser", "firefox:stable", "--headless", "--config-file=cypress.config.ts"]
# command: ["/bin/sh"]
# args: ["-c", "while true; do echo hello; sleep 120;done"]
workingDir: /e2e
volumeMounts:
- name: tls-certs
mountPath: /e2e/testdata/sk8l-certs
readOnly: true
- name: xapp
mountPath: /e2e/cypress/screenshots
- name: ca-certificate-only
mountPath: /usr/lib/mozilla/certificates
readOnly: true
- name: ca-certificate-only
mountPath: /usr/lib64/mozilla/certificates
readOnly: true
- name: ca-certificate-only
mountPath: ~/.mozilla/certificates
readOnly: true
restartPolicy: Never
volumes:
- name: xapp
Expand All @@ -46,26 +38,26 @@ spec:
- name: tls-certs
projected:
sources:
- secret:
name: sk8l-tls-server-cert
items:
- key: tls.crt
path: server-cert.pem
- key: tls.key
path: server-key.pem
- key: ca.crt
path: ca-cert.pem
- configMap:
name: sk8l
items:
- key: trust-bundle.crt
path: ca-certificates.crt
- secret:
name: sk8l-server-cert-secret
items:
- key: tls.crt
path: server-cert.pem
- key: tls.key
path: server-key.pem
- key: ca.crt
path: ca-cert.pem
- configMap:
name: sk8l-ca-cert-cm
items:
- key: trust-bundle.crt
path: ca-certificates.crt
- name: ca-certificate-only
projected:
sources:
- configMap:
name: sk8l
items:
- key: trust-bundle.crt
path: ca-certificates.crt
- configMap:
name: sk8l-ca-cert-cm
items:
- key: trust-bundle.crt
path: ca-certificates.crt
backoffLimit: 1

0 comments on commit 992fe38

Please sign in to comment.