diff --git a/.github/workflows/scan-codeql.yml b/.github/workflows/scan-codeql.yml index 7c62b301ae..8713d28567 100644 --- a/.github/workflows/scan-codeql.yml +++ b/.github/workflows/scan-codeql.yml @@ -15,8 +15,6 @@ on: - "**.svg" - "adr/**" - "docs/**" - - "package.json" - - "package-lock.json" - "CODEOWNERS" schedule: - cron: "32 2 * * 5" diff --git a/.github/workflows/scan-cves.yml b/.github/workflows/scan-cves.yml index 9f6522d307..0dfe776713 100644 --- a/.github/workflows/scan-cves.yml +++ b/.github/workflows/scan-cves.yml @@ -10,8 +10,8 @@ on: paths: - "go.mod" - "go.sum" - - "package.json" - - "package-lock.json" + - "src/ui/package.json" + - "src/ui/package-lock.json" - "cargo.toml" - "cargo.lock" diff --git a/.github/workflows/test-bigbang.yml b/.github/workflows/test-bigbang.yml index 7e598828a0..02bf391377 100644 --- a/.github/workflows/test-bigbang.yml +++ b/.github/workflows/test-bigbang.yml @@ -9,8 +9,6 @@ on: - "**.svg" - "adr/**" - "docs/**" - - "package.json" - - "package-lock.json" - "CODEOWNERS" permissions: @@ -37,8 +35,8 @@ jobs: - name: Build Zarf binary uses: ./.github/actions/packages with: - init-package: 'false' - build-examples: 'false' + init-package: "false" + build-examples: "false" - name: Login to Iron Bank uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 diff --git a/.github/workflows/test-e2e-shim.yml b/.github/workflows/test-e2e-shim.yml new file mode 100644 index 0000000000..75e43f1ca1 --- /dev/null +++ b/.github/workflows/test-e2e-shim.yml @@ -0,0 +1,63 @@ +name: Docs Skip Shim +on: + pull_request: + paths: + - "**.md" + - "**.jpg" + - "**.png" + - "**.gif" + - "**.svg" + - "adr/**" + - "docs/**" + - "CODEOWNERS" + +# This is here to act as a shim for branch protection rules to work correctly. +# This is ugly but this seems to be the best way to do this since: +# - Job names in a workflow must be unique +# - When paths are ignored not all jobs are reported to the branch protection rules +# - Multiple jobs of the same name are still required by branch protection rules + +# For more info see below: +# https://github.com/orgs/community/discussions/54877 +# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks + +# Abort prior jobs in the same workflow / PR +concurrency: + group: e2e-skip-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Skipped + run: | + echo skipped + + validate-k3d: + runs-on: ubuntu-latest + steps: + - name: Skipped + run: | + echo skipped + + validate-k3s: + runs-on: ubuntu-latest + steps: + - name: Skipped + run: | + echo skipped + + validate-kind: + runs-on: ubuntu-latest + steps: + - name: Skipped + run: | + echo skipped + + validate-minikube: + runs-on: ubuntu-latest + steps: + - name: Skipped + run: | + echo skipped diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml new file mode 100644 index 0000000000..5220f18698 --- /dev/null +++ b/.github/workflows/test-e2e.yml @@ -0,0 +1,167 @@ +name: Test Cross-Cluster +on: + pull_request: + paths-ignore: + - "**.md" + - "**.jpg" + - "**.png" + - "**.gif" + - "**.svg" + - "adr/**" + - "docs/**" + - "CODEOWNERS" + +permissions: + contents: read + +# Abort prior jobs in the same workflow / PR +concurrency: + group: e2e-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Build the binary and init package + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: Setup golang + uses: ./.github/actions/golang + + - name: Setup NodeJS + uses: ./.github/actions/node + + - name: Build binary and zarf packages + uses: ./.github/actions/packages + with: + build-examples: "false" + + # Upload the contents of the build directory for later stages to use + - name: Upload build artifacts + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: build-artifacts + path: build/ + retention-days: 1 + + # Run the tests on k3d + validate-k3d: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: build-artifacts + path: build/ + + - name: Setup golang + uses: ./.github/actions/golang + + - name: Setup K3d + uses: ./.github/actions/k3d + + - name: Run tests + run: | + chmod +x build/zarf + make test-e2e ARCH=amd64 + + - name: Save logs + if: always() + uses: ./.github/actions/save-logs + + # Run the tests on k3s + validate-k3s: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: build-artifacts + path: build/ + + - name: Setup golang + uses: ./.github/actions/golang + + - name: Run tests + # NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of go installed + # 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 + # chown the logs since they were originally created as root + run: | + chmod +x build/zarf + sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true make test-e2e ARCH=amd64 + sudo chown $USER /tmp/zarf-*.log + + - name: Save logs + if: always() + uses: ./.github/actions/save-logs + + # Run the tests on kind + validate-kind: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: build-artifacts + path: build/ + + - name: Setup golang + uses: ./.github/actions/golang + + - name: Setup Kind + run: | + kind delete cluster && kind create cluster + kubectl scale deploy -n kube-system coredns --replicas=1 + + - name: Run tests + run: | + chmod +x build/zarf + make test-e2e ARCH=amd64 + + - name: Save logs + if: always() + uses: ./.github/actions/save-logs + + # Run the tests on minikube + validate-minikube: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: build-artifacts + path: build/ + + - name: Setup golang + uses: ./.github/actions/golang + + - name: Setup Minikube + run: minikube start --driver=docker + + - name: Run tests + run: | + chmod +x build/zarf + make test-e2e ARCH=amd64 + + - name: Save logs + if: always() + uses: ./.github/actions/save-logs diff --git a/.github/workflows/test-external.yml b/.github/workflows/test-external.yml index 8b87e7fd95..e0aaf3946a 100644 --- a/.github/workflows/test-external.yml +++ b/.github/workflows/test-external.yml @@ -9,8 +9,6 @@ on: - "**.svg" - "adr/**" - "docs/**" - - "package.json" - - "package-lock.json" - "CODEOWNERS" permissions: diff --git a/.github/workflows/test-k3d.yml b/.github/workflows/test-k3d.yml deleted file mode 100644 index 3a244f06ea..0000000000 --- a/.github/workflows/test-k3d.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Test K3d Cluster -on: - pull_request: - paths-ignore: - - "**.md" - - "**.jpg" - - "**.png" - - "**.gif" - - "**.svg" - - "adr/**" - - "docs/**" - - "package.json" - - "package-lock.json" - - "CODEOWNERS" - -permissions: - contents: read - -# Abort prior jobs in the same workflow / PR -concurrency: - group: e2e-k3d-${{ github.ref }} - cancel-in-progress: true - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - - name: Setup golang - uses: ./.github/actions/golang - - - name: Setup NodeJS - uses: ./.github/actions/node - - - name: Build binary and zarf packages - uses: ./.github/actions/packages - - - name: Setup K3d - uses: ./.github/actions/k3d - - - name: Run tests - run: make test-e2e ARCH=amd64 - - - name: Save logs - if: always() - uses: ./.github/actions/save-logs diff --git a/.github/workflows/test-k3s.yml b/.github/workflows/test-k3s.yml deleted file mode 100644 index c498996860..0000000000 --- a/.github/workflows/test-k3s.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Test K3s Cluster -on: - pull_request: - paths-ignore: - - "**.md" - - "**.jpg" - - "**.png" - - "**.gif" - - "**.svg" - - "adr/**" - - "docs/**" - - "package.json" - - "package-lock.json" - - "CODEOWNERS" - -permissions: - contents: read - -# Abort prior jobs in the same workflow / PR -concurrency: - group: e2e-k3s-${{ github.ref }} - cancel-in-progress: true - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - - name: Setup golang - uses: ./.github/actions/golang - - - name: Setup NodeJS - uses: ./.github/actions/node - - - name: Build binary and zarf packages - uses: ./.github/actions/packages - - - name: "Run Tests" - # NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of go installed - # 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 - # chown the logs since they were originally created as root - run: | - sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true make test-e2e ARCH=amd64 - sudo chown $USER /tmp/zarf-*.log - - - name: Save logs - if: always() - uses: ./.github/actions/save-logs diff --git a/.github/workflows/test-kind.yml b/.github/workflows/test-kind.yml deleted file mode 100644 index 3c4afafd02..0000000000 --- a/.github/workflows/test-kind.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Test Kind Cluster -on: - pull_request: - paths-ignore: - - "**.md" - - "**.jpg" - - "**.png" - - "**.gif" - - "**.svg" - - "adr/**" - - "docs/**" - - "package.json" - - "package-lock.json" - - "CODEOWNERS" - -permissions: - contents: read - -# Abort prior jobs in the same workflow / PR -concurrency: - group: e2e-kind-${{ github.ref }} - cancel-in-progress: true - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - - name: Setup golang - uses: ./.github/actions/golang - - - name: Setup NodeJS - uses: ./.github/actions/node - - - name: Build binary and zarf packages - uses: ./.github/actions/packages - - - name: Setup Kind - run: | - kind delete cluster && kind create cluster - kubectl scale deploy -n kube-system coredns --replicas=1 - - - name: Run tests - run: make test-e2e ARCH=amd64 - - - name: Save logs - if: always() - uses: ./.github/actions/save-logs diff --git a/.github/workflows/test-minikube.yml b/.github/workflows/test-minikube.yml deleted file mode 100644 index 6fbc41f2f0..0000000000 --- a/.github/workflows/test-minikube.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Test Minikube (Docker) Cluster -on: - pull_request: - paths-ignore: - - "**.md" - - "**.jpg" - - "**.png" - - "**.gif" - - "**.svg" - - "adr/**" - - "docs/**" - - "package.json" - - "package-lock.json" - - "CODEOWNERS" - -permissions: - contents: read - -# Abort prior jobs in the same workflow / PR -concurrency: - group: e2e-minikube-${{ github.ref }} - cancel-in-progress: true - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - - name: Setup golang - uses: ./.github/actions/golang - - - name: Setup NodeJS - uses: ./.github/actions/node - - - name: Build binary and zarf packages - uses: ./.github/actions/packages - - - name: Setup Minikube - run: minikube start --driver=docker - - - name: Run tests - run: make test-e2e ARCH=amd64 - - - name: Save logs - if: always() - uses: ./.github/actions/save-logs diff --git a/.github/workflows/test-upgrade.yml b/.github/workflows/test-upgrade.yml index 822e4a6f80..d4319fc2e9 100644 --- a/.github/workflows/test-upgrade.yml +++ b/.github/workflows/test-upgrade.yml @@ -1,4 +1,4 @@ -name: Test Zarf Upgrade +name: Test Upgrade on: pull_request: paths-ignore: @@ -9,8 +9,6 @@ on: - "**.svg" - "adr/**" - "docs/**" - - "package.json" - - "package-lock.json" - "CODEOWNERS" permissions: @@ -37,7 +35,7 @@ jobs: - name: Build PR binary and zarf init package uses: ./.github/actions/packages with: - build-examples: 'false' + build-examples: "false" # Upload the contents of the build directory for later stages to use - name: Upload build artifacts @@ -93,7 +91,7 @@ jobs: sudo env "PATH=$PATH" CI=true zarf tools kubectl describe deployments -n=podinfo-upgrade sudo env "PATH=$PATH" CI=true zarf tools kubectl describe pods -n=podinfo-upgrade - - name: "Run the PR's tests" + - name: Run tests # NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of go installed # in a previous step. This test run will use this PR's Zarf to create a K3s cluster. # chown the logs since they were originally created as root diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index d53339b7e0..863337c0a0 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -9,8 +9,6 @@ on: - "**.svg" - "adr/**" - "docs/**" - - "package.json" - - "package-lock.json" - "CODEOWNERS" permissions: