Skip to content

Commit

Permalink
Fix/zarf agent flux mutation (#572)
Browse files Browse the repository at this point in the history
- Proper binding of CREATE and UPDATE for Pods and Gitrepositories
- Add open source flux example for testing
- Add E2E for Flux
- Add retry logic for zarf connect/tunnel establishment
- Fix test stability issues with zarf connect actions and data injection tests
- Move to self-hosted runners
  • Loading branch information
jeff-mccoy authored Jul 16, 2022
1 parent 1778793 commit 1d8bd2d
Show file tree
Hide file tree
Showing 25 changed files with 5,991 additions and 349 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
push-resources:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Install GoLang
uses: actions/setup-go@v3
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/test-k3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ name: test-k3d
on:
pull_request:
paths-ignore:
- '**.md'
- '**.jpg'
- '**.png'
- '**.gif'
- '**.svg'
- 'adr/**'
- 'docs/**'
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"

jobs:
validate:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: "Ensure workspace file ownership"
run: |
sudo chown -R ${USER} "${GITHUB_WORKSPACE}"
sudo rm -fr ~/.kube
sudo rm -fr /tmp/zarf*
sudo /opt/zarf/zarf-clean-k3s.sh || echo ''
- name: "Install GoLang"
uses: actions/setup-go@v3
with:
Expand All @@ -22,18 +29,8 @@ jobs:
- name: "Checkout Repo"
uses: actions/checkout@v3

- name: "Setup caching"
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "Install K3d and init a cluster"
run: brew install k3d && k3d cluster delete && k3d cluster create
- name: "Create a K3d cluster"
run: k3d cluster delete && k3d cluster create

- name: "Build CLI"
run: make build-cli-linux-amd ARCH=amd64
Expand All @@ -44,3 +41,6 @@ jobs:
- name: "Run Tests"
# NOTE: This test run will create its own K3d cluster. A single cluster will be used throughout the test run.
run: make test-e2e ARCH=amd64

- name: "Cleanup"
run: make destroy
36 changes: 18 additions & 18 deletions .github/workflows/test-k3s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ name: test-k3s
on:
pull_request:
paths-ignore:
- '**.md'
- '**.jpg'
- '**.png'
- '**.gif'
- '**.svg'
- 'adr/**'
- 'docs/**'
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"

jobs:
validate:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: "Ensure workspace file ownership"
run: |
sudo chown -R ${USER} "${GITHUB_WORKSPACE}"
sudo rm -fr /root/.kube
sudo rm -fr /tmp/zarf*
sudo /opt/zarf/zarf-clean-k3s.sh || echo ''
- name: "Install GoLang"
uses: actions/setup-go@v3
with:
Expand All @@ -22,16 +29,6 @@ jobs:
- name: "Checkout Repo"
uses: actions/checkout@v3

- name: "Setup caching"
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "Build CLI"
run: make build-cli-linux-amd ARCH=amd64

Expand All @@ -43,3 +40,6 @@ jobs:
# in a previous step. This test run will use Zarf to create a K3s cluster, and a brand new cluster will be
# used for each test
run: sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true make test-e2e ARCH=amd64

- name: "Cleanup"
run: sudo make destroy
40 changes: 20 additions & 20 deletions .github/workflows/test-kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ name: test-kind
on:
pull_request:
paths-ignore:
- '**.md'
- '**.jpg'
- '**.png'
- '**.gif'
- '**.svg'
- 'adr/**'
- 'docs/**'
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"

jobs:
validate:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: "Ensure workspace file ownership"
run: |
sudo chown -R ${USER} "${GITHUB_WORKSPACE}"
sudo rm -fr ~/.kube
sudo rm -fr /tmp/zarf*
sudo /opt/zarf/zarf-clean-k3s.sh || echo ''
- name: "Install GoLang"
uses: actions/setup-go@v3
with:
Expand All @@ -22,18 +29,8 @@ jobs:
- name: "Checkout Repo"
uses: actions/checkout@v3

- name: "Setup caching"
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "Zarf Install Guide: Kind Cluster Init"
run: brew install kind && kind delete cluster && kind create cluster
- name: "Create a KinD cluster"
run: kind delete cluster && kind create cluster

- name: "Build CLI"
run: make build-cli-linux-amd ARCH=amd64
Expand All @@ -46,3 +43,6 @@ jobs:
# rather than having the test suite do it. The K3d tests do a self-provisioned cluster and the K3s tests
# use Zarf to create the cluster. In this test a single cluster will be used throughout the test run.
run: make test-e2e ARCH=amd64

- name: "Cleanup"
run: make destroy
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ vm-destroy: ## Destroy the VM
clean: ## Clean the build dir
rm -rf build

destroy:
$(ZARF_BIN) destroy --confirm --remove-components
rm -fr build

build-cli-linux-amd: build-injector-registry
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(BUILD_ARGS)" -o build/zarf main.go

Expand Down Expand Up @@ -95,6 +99,8 @@ build-examples:

@test -s ./build/zarf-package-compose-example-$(ARCH).tar.zst || $(ZARF_BIN) package create examples/composable-packages -o build -a $(ARCH) --confirm

@test -s ./build/zarf-package-flux-test-${ARCH}.tar.zst || $(ZARF_BIN) package create examples/flux-test -o build -a $(ARCH) --confirm

## Run e2e tests. Will automatically build any required dependencies that aren't present.
## Requires an existing cluster for the env var APPLIANCE_MODE=true
.PHONY: test-e2e
Expand Down
Loading

0 comments on commit 1d8bd2d

Please sign in to comment.