diff --git a/.github/actions/build-image/action.yaml b/.github/actions/build-image/action.yaml index 895a5d2..5e7eb68 100644 --- a/.github/actions/build-image/action.yaml +++ b/.github/actions/build-image/action.yaml @@ -1,10 +1,15 @@ name: build-image description: "Build image" +inputs: + flavor: + description: "The flavor of the zarf package" + required: true + runs: using: composite steps: - run: | set +o history && echo ${REGISTRY1_PASSWORD} | zarf tools registry login registry1.dso.mil --username ${REGISTRY1_USERNAME} --password-stdin || set -o history - make build + make build-${{ inputs.flavor }} shell: bash diff --git a/.github/actions/tests/action.yaml b/.github/actions/tests/action.yaml index 6c00c02..dcf0ff7 100644 --- a/.github/actions/tests/action.yaml +++ b/.github/actions/tests/action.yaml @@ -1,9 +1,14 @@ name: install-tools description: "Run Tests" +inputs: + flavor: + description: "The flavor of the zarf package" + required: true + runs: using: composite steps: - run: | - zarf dev lint + cd zarf/${{ inputs.flavor }} && zarf dev lint shell: bash diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index c7fa41c..f4b9b87 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -15,6 +15,10 @@ jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + flavor: [ full, minimal ] + permissions: contents: read packages: write @@ -30,9 +34,13 @@ jobs: - name: Lint uses: ./.github/actions/tests + with: + flavor: ${{ matrix.flavor }} - name: Build image uses: ./.github/actions/build-image env: REGISTRY1_USERNAME: ${{ secrets.REGISTRY1_USERNAME }} REGISTRY1_PASSWORD: ${{ secrets.REGISTRY1_PASSWORD }} + with: + flavor: ${{ matrix.flavor }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3866ac5..22b759d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,6 +15,10 @@ jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + flavor: [ full, minimal ] + permissions: contents: read packages: write @@ -40,10 +44,12 @@ jobs: env: REGISTRY1_USERNAME: ${{ secrets.REGISTRY1_USERNAME }} REGISTRY1_PASSWORD: ${{ secrets.REGISTRY1_PASSWORD }} + with: + flavor: ${{ matrix.flavor }} - - name: "Sign and Publish the image" + - name: "Sign and Publish the ${{ matrix.flavor }} image" run: | - zarf package publish build/zarf-init-amd64-v${ZARF_VERSION}.tar.zst oci://ghcr.io/radiusmethod/zarf-init-bigbang-k3s-ha --signing-key awskms:///alias/zarf-init-bigbang + zarf package publish build/zarf-init-${{ matrix.flavor }}-amd64-v${ZARF_VERSION}.tar.zst oci://ghcr.io/radiusmethod/zarf-init-bigbang-k3s-ha --signing-key awskms:///alias/zarf-init-bigbang env: AWS_REGION: ${{ secrets.AWS_REGION }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_GOV }} diff --git a/Makefile b/Makefile index e0afaf7..223fe5e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -.PHONY: build - ARCH:=amd64 # renovate: depName=defenseunicorns/zarf ZARF_VERSION:="0.33.2" @@ -9,10 +7,12 @@ GITEA_VERSION:="1.21.11" REGISTRY_VERSION:="2.8.3" ZARF_DIR:="zarf" -BUILD_DIR:="build" +BUILD_DIR:="../../build" KMS_ALIAS:="zarf-init-bigbang" -build: +.PHONY: build-full +build-full: + cd zarf/full && \ zarf package create -o $(BUILD_DIR) -a $(ARCH) --confirm . \ --set REGISTRY_IMAGE_DOMAIN="registry1.dso.mil/" \ --set REGISTRY_IMAGE="ironbank/opensource/docker/registry-v2" \ @@ -22,7 +22,15 @@ build: --set AGENT_IMAGE_TAG=v$(ZARF_VERSION) \ --set INJECTOR_VERSION="2023-08-02" \ --set INJECTOR_AMD64_SHASUM="91de0768855ee2606a4f85a92bb480ff3a14ca205fd8d05eb397c18e15aa0247" \ - --set GITEA_IMAGE=registry1.dso.mil/ironbank/opensource/go-gitea/gitea:v$(GITEA_VERSION) + --set GITEA_IMAGE=registry1.dso.mil/ironbank/opensource/go-gitea/gitea:v$(GITEA_VERSION) && \ + mv $(BUILD_DIR)/zarf-init-amd64-v$(ZARF_VERSION).tar.zst $(BUILD_DIR)/zarf-init-full-amd64-v$(ZARF_VERSION).tar.zst + +.PHONY: build-minimal +build-minimal: + cd zarf/minimal && \ + zarf package create -o $(BUILD_DIR) -a $(ARCH) --confirm . && \ + mv $(BUILD_DIR)/zarf-init-amd64-v$(ZARF_VERSION).tar.zst $(BUILD_DIR)/zarf-init-minimal-amd64-v$(ZARF_VERSION).tar.zst +.PHONY: generate-key-pair generate-key-pair: cosign generate-key-pair --kms awskms:///alias/$(KMS_ALIAS) diff --git a/zarf.yaml b/zarf/full/zarf.yaml similarity index 96% rename from zarf.yaml rename to zarf/full/zarf.yaml index dca6786..8b7240d 100644 --- a/zarf.yaml +++ b/zarf/full/zarf.yaml @@ -1,12 +1,12 @@ kind: ZarfInitConfig metadata: - name: init + name: full description: Used to establish a new Zarf cluster components: - name: k3s import: - path: k3s + path: ../../k3s - name: zarf-injector required: true diff --git a/zarf/minimal/zarf.yaml b/zarf/minimal/zarf.yaml new file mode 100644 index 0000000..c67c13b --- /dev/null +++ b/zarf/minimal/zarf.yaml @@ -0,0 +1,10 @@ +kind: ZarfInitConfig +metadata: + name: minimal + description: Minimal package with k3s only + +components: + - name: k3s + required: true + import: + path: ../../k3s