This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
Update images digests #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Chainguard, Inc. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Test | |
on: | |
pull_request: | |
branches: ['main'] | |
jobs: | |
publish: | |
name: E2E Kind | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5.0.2 | |
with: | |
go-version: '1.20.x' | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: ko-build/setup-ko@v0.7 | |
# Test building on pull requests. | |
- uses: chainguard-dev/actions/setup-kind@main | |
with: | |
k8s-version: v1.26.x | |
registry-authority: registry.local:5000 | |
- run: | | |
echo KO_DOCKER_REPO=registry.local:5000/kontext >> "$GITHUB_ENV" | |
- run: | | |
EXPANDER="$(ko build --bare --platform=all ./cmd/expander)" | |
BUNDLE="$(go run -ldflags="-X github.com/chainguard-dev/kontext.BaseImageString=${EXPANDER}" \ | |
./cmd/bundler -directory=. -tag=registry.local:5000/bundle)" | |
cat > foo.yaml <<EOF | |
apiVersion: batch/v1 | |
kind: Job | |
metadata: | |
name: test | |
spec: | |
backoffLimit: 0 | |
template: | |
spec: | |
restartPolicy: Never | |
initContainers: | |
- name: expand-bundle | |
image: ${BUNDLE} | |
workingDir: /workspace | |
volumeMounts: | |
- name: bundle | |
mountPath: /workspace | |
# Add a container for each test we want to run against the bundle. | |
containers: | |
- name: test-git-log | |
image: cgr.dev/chainguard/git:latest-glibc-dev | |
workingDir: /workspace | |
volumeMounts: | |
- name: bundle | |
mountPath: /workspace | |
command: ["/bin/sh", "-c"] | |
args: | |
- | | |
git config --global --add safe.directory /workspace | |
git log -1 --pretty=%ct --follow go.mod | |
- name: test-symlinks | |
image: cgr.dev/chainguard/busybox:latest-glibc | |
workingDir: /workspace | |
volumeMounts: | |
- name: bundle | |
mountPath: /workspace | |
command: ["/bin/sh", "-c"] | |
args: | |
- | | |
# Check that it has the right data... | |
if [ "hello" != "$(cat e2e-testdata/blah)" ] ; then | |
echo Incorrect content | |
exit 1 | |
fi | |
# Check that is is a symlink | |
if [[ ! -L e2e-testdata/blah ]]; then | |
echo Not a symlink | |
exit 1 | |
fi | |
volumes: | |
- name: bundle | |
emptyDir: {} | |
EOF | |
kubectl apply -f foo.yaml | |
sleep 5 | |
kubectl wait --timeout 1m --for=condition=Complete jobs test | |
- name: Collect diagnostics and upload | |
if: ${{ failure() }} | |
uses: chainguard-dev/actions/kind-diag@main |