Merge pull request #4764 from fluxcd/iac-update-e2e-test

ci: Adapt image automation test to v1beta2
pull/4678/head
Stefan Prodan 8 months ago committed by GitHub
commit 7b8906fe41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -32,14 +32,14 @@ jobs:
cluster_name: kind cluster_name: kind
# The versions below should target the newest Kubernetes version # The versions below should target the newest Kubernetes version
# Keep this up-to-date with https://endoflife.date/kubernetes # Keep this up-to-date with https://endoflife.date/kubernetes
node_image: kindest/node:v1.29.2 node_image: ghcr.io/fluxcd/kindest/node:v1.30.0-amd64
kubectl_version: v1.29.2 kubectl_version: v1.30.0
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@main uses: fluxcd/pkg/actions/kustomize@main
- name: Setup yq
uses: fluxcd/pkg/actions/yq@main
- name: Build - name: Build
run: | run: make build-dev
make cmd/flux/.manifests.done
go build -o /tmp/flux ./cmd/flux
- name: Set outputs - name: Set outputs
id: vars id: vars
run: | run: |
@ -51,7 +51,7 @@ jobs:
echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT echo "test_repo_name=$TEST_REPO_NAME" >> $GITHUB_OUTPUT
- name: bootstrap init - name: bootstrap init
run: | run: |
/tmp/flux bootstrap github --manifests ./manifests/install/ \ ./bin/flux bootstrap github --manifests ./manifests/install/ \
--owner=fluxcd-testing \ --owner=fluxcd-testing \
--image-pull-secret=ghcr-auth \ --image-pull-secret=ghcr-auth \
--registry-creds=fluxcd:$GITHUB_TOKEN \ --registry-creds=fluxcd:$GITHUB_TOKEN \
@ -66,7 +66,7 @@ jobs:
kubectl -n flux-system get secret ghcr-auth | grep dockerconfigjson kubectl -n flux-system get secret ghcr-auth | grep dockerconfigjson
- name: bootstrap no-op - name: bootstrap no-op
run: | run: |
/tmp/flux bootstrap github --manifests ./manifests/install/ \ ./bin/flux bootstrap github --manifests ./manifests/install/ \
--owner=fluxcd-testing \ --owner=fluxcd-testing \
--image-pull-secret=ghcr-auth \ --image-pull-secret=ghcr-auth \
--repository=${{ steps.vars.outputs.test_repo_name }} \ --repository=${{ steps.vars.outputs.test_repo_name }} \
@ -78,7 +78,7 @@ jobs:
- name: bootstrap customize - name: bootstrap customize
run: | run: |
make setup-bootstrap-patch make setup-bootstrap-patch
/tmp/flux bootstrap github --manifests ./manifests/install/ \ ./bin/flux bootstrap github --manifests ./manifests/install/ \
--owner=fluxcd-testing \ --owner=fluxcd-testing \
--repository=${{ steps.vars.outputs.test_repo_name }} \ --repository=${{ steps.vars.outputs.test_repo_name }} \
--branch=main \ --branch=main \
@ -93,46 +93,31 @@ jobs:
GITHUB_ORG_NAME: fluxcd-testing GITHUB_ORG_NAME: fluxcd-testing
- name: uninstall - name: uninstall
run: | run: |
/tmp/flux uninstall -s --keep-namespace ./bin/flux uninstall -s --keep-namespace
kubectl delete ns flux-system --timeout=10m --wait=true kubectl delete ns flux-system --timeout=10m --wait=true
- name: test image automation - name: test image automation
run: | run: |
make setup-image-automation make setup-image-automation
/tmp/flux bootstrap github --manifests ./manifests/install/ \ ./bin/flux bootstrap github --manifests ./manifests/install/ \
--owner=fluxcd-testing \ --owner=fluxcd-testing \
--repository=${{ steps.vars.outputs.test_repo_name }} \ --repository=${{ steps.vars.outputs.test_repo_name }} \
--branch=main \ --branch=main \
--path=test-cluster \ --path=test-cluster \
--read-write-key --read-write-key
/tmp/flux reconcile image repository podinfo ./bin/flux reconcile image repository podinfo
/tmp/flux get images all ./bin/flux reconcile image update flux-system
./bin/flux get images all
retries=10 kubectl -n flux-system get -o yaml ImageUpdateAutomation flux-system | \
count=0 yq '.status.lastPushCommit | length > 1' | grep 'true'
ok=false
until ${ok}; do
/tmp/flux get image update flux-system | grep 'commit' && ok=true || ok=false
count=$(($count + 1))
if [[ ${count} -eq ${retries} ]]; then
echo "No more retries left"
exit 1
fi
sleep 6
/tmp/flux reconcile image update flux-system
done
env: env:
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
GITHUB_REPO_NAME: ${{ steps.vars.outputs.test_repo_name }} GITHUB_REPO_NAME: ${{ steps.vars.outputs.test_repo_name }}
GITHUB_ORG_NAME: fluxcd-testing GITHUB_ORG_NAME: fluxcd-testing
- name: delete repository - name: delete repository
if: ${{ always() }} if: ${{ always() }}
continue-on-error: true
run: | run: |
curl \ gh repo delete fluxcd-testing/${{ steps.vars.outputs.test_repo_name }} --yes
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--fail --silent \
https://api.github.com/repos/fluxcd-testing/${{ steps.vars.outputs.test_repo_name }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
- name: Debug failure - name: Debug failure

@ -81,8 +81,7 @@ install-envtest: setup-envtest
ENVTEST = $(shell pwd)/bin/setup-envtest ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest .PHONY: envtest
setup-envtest: ## Download envtest-setup locally if necessary. setup-envtest: ## Download envtest-setup locally if necessary.
# replace the commit SHA with 'latest' when https://github.com/kubernetes-sigs/controller-runtime/issues/2720 is fixed $(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@c7e1dc9b5302d649d5531e19168dd7ea0013736d)
# go-install-tool will 'go install' any package $2 and install it to $1. # go-install-tool will 'go install' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

@ -42,7 +42,7 @@ rm -rf $OUT_PATH
mkdir -p $OUT_PATH mkdir -p $OUT_PATH
files="" files=""
info using "$(kustomize version --short)" info using kustomize "$(kustomize version)"
# build controllers # build controllers
for controller in ${IN_PATH}/bases/*/; do for controller in ${IN_PATH}/bases/*/; do

Loading…
Cancel
Save