Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding flavored packages #1

Merged
merged 12 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/actions/build-image/action.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion .github/actions/tests/action.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
flavor: [ full, minimal ]

permissions:
contents: read
packages: write
Expand All @@ -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 }}
10 changes: 8 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
flavor: [ full, minimal ]

permissions:
contents: read
packages: write
Expand All @@ -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 }}
Expand Down
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.PHONY: build

ARCH:=amd64
# renovate: depName=defenseunicorns/zarf
ZARF_VERSION:="0.33.2"
Expand All @@ -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" \
Expand All @@ -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)
4 changes: 2 additions & 2 deletions zarf.yaml → zarf/full/zarf.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions zarf/minimal/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kind: ZarfInitConfig
metadata:
name: minimal
description: Minimal package with k3s only

components:
- name: k3s
required: true
import:
path: ../../k3s