Skip to content

Commit

Permalink
ci: restructure nightly tests (#480)
Browse files Browse the repository at this point in the history
* ci: restructure nightly tests

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>

* ci: remove the slow tests from nightly

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

---------

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha authored Aug 9, 2023
1 parent ac051d2 commit 684b586
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 70 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/convert.yaml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Nightly"

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

env:
REGISTRY_URL: localhost:5000

jobs:
slow-tests:
name: "slow tests"
runs-on: ubuntu-20.04
steps:
- uses: actions/cache@v3
id: restore-build
with:
path: stacker
key: ${{ github.sha }}
- name: zot registry
env:
ZOT_HOST: localhost
ZOT_PORT: 5000
run: |
# start a zot instance (minimal)
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
51 changes: 50 additions & 1 deletion test/convert.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,58 @@ EOF
mkdir -p /out
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=app
if [ -z "${REGISTRY_URL}" ]; then
skip "skipping test because no registry found in REGISTRY_URL env variable"
skip "test because no registry found in REGISTRY_URL env variable"
fi
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=app --skip-tls --url docker://${REGISTRY_URL} --layer app --tag latest
rm -f stacker.yaml stacker-subs.yaml
stacker clean
}

@test "alpine" {
if [ -z "${SLOW_TEST}" ]; then
skip "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 "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 "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 684b586

Please sign in to comment.