Skip to content

Commit

Permalink
ci: restructure nightly tests
Browse files Browse the repository at this point in the history
Currently, we run "convert" tests offline/nightly.
Define a SLOW_TEST, so that more tests can be added.

Also, rename/redefine nightly ci job.

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha committed Aug 4, 2023
1 parent 3602d74 commit 6d58f6f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "convert dockerfiles"
name: "Nightly"

on:
workflow_dispatch:
Expand All @@ -9,8 +9,8 @@ env:
REGISTRY_URL: localhost:5000

jobs:
convert:
name: "convert"
slow-tests:
name: "slow tests"
runs-on: ubuntu-20.04
steps:
- uses: actions/cache@v3
Expand All @@ -27,6 +27,11 @@ jobs:
podman run -d -p ${ZOT_PORT}:${ZOT_PORT} ghcr.io/project-zot/zot-minimal-linux-amd64:latest
# check if reachable
while true; do x=0; curl -f http://${REGISTRY_URL}/v2/ || x=1; if [ $x -eq 0 ]; then break; fi; sleep 1; done
- name: test
env:
SLOW_TEST: true
run: |
make check
- name: alpine
run: |
export PATH=$PATH:$GITHUB_WORKSPACE
Expand Down
49 changes: 49 additions & 0 deletions test/convert.bats
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,52 @@ EOF
rm -f stacker.yaml stacker-subs.yaml
stacker clean
}

@test "alpine" {
if [ -z "${SLOW_TEST}" ]; then
skip "skipping test since slow tests are not enabled"
fi
git clone https://github.com/alpinelinux/docker-alpine.git
chmod -R a+rwx docker-alpine
cd docker-alpine
TEMPDIR=$(mktemp -d)
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --substitute STACKER_VOL1="$TEMPDIR"
if [ -nz "${REGISTRY_URL}" ]; then
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --substitute STACKER_VOL1="$TEMPDIR" --skip-tls --url docker://${REGISTRY_URL} --layer alpine --tag latest
fi
rm -f stacker.yaml stacker-subs.yaml
stacker clean
}

@test "elasticsearch" {
if [ -z "${SLOW_TEST}" ]; then
skip "skipping test since slow tests are not enabled"
fi
git clone https://github.com/elastic/dockerfiles.git
chmod -R a+rwx dockerfiles
cd dockerfiles/elasticsearch
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch
if [ -nz "${REGISTRY_URL}" ]; then
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch --skip-tls --url docker://${REGISTRY_URL} --layer elasticsearch --tag latest
fi
rm -f stacker.yaml stacker-subs.yaml
stacker clean
}

@test "python" {
if [ -z "${SLOW_TEST}" ]; then
skip "skipping test since slow tests are not enabled"
fi
git clone https://github.com/docker-library/python.git
cd python/3.11/alpine3.17
chmod -R a+rw .
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python
if [ -nz "${REGISTRY_URL}" ]; then
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python --skip-tls --url docker://${REGISTRY_URL} --layer python --tag latest
fi
rm -f stacker.yaml stacker-subs.yaml
stacker clean
}

0 comments on commit 6d58f6f

Please sign in to comment.