Skip to content

Commit 8ae172b

Browse files
committed
add ci
1 parent 3602381 commit 8ae172b

File tree

4 files changed

+147
-2
lines changed

4 files changed

+147
-2
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Zarf Packages - Build, Sign, and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
paths:
8+
- '**/zarf.yaml'
9+
10+
jobs:
11+
publish-zarf:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
env:
18+
REGISTRY: ghcr.io
19+
REGISTRY_USERNAME: ${{ github.actor }}
20+
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
OCI_PATH: ${{ env.REGISTRY }}/${{ github.repository_owner }}
22+
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install Zarf
30+
uses: zarf-dev/setup-zarf@v1
31+
with:
32+
version: latest
33+
34+
- name: Zarf Registry Login
35+
run: |
36+
echo "${{ env.REGISTRY_TOKEN }}" | zarf tools registry login ${{ env.REGISTRY }} \
37+
--username ${{ env.REGISTRY_USERNAME }} \
38+
--password-stdin
39+
40+
- name: Detect and Process Changed Packages
41+
env:
42+
SIGNING_KEY_DATA: ${{ secrets.ZARF_SIGNING_KEY }}
43+
KEY_PASSWORD: ${{ secrets.ZARF_KEY_PASSWORD }}
44+
run: |
45+
touch cosign.key
46+
chmod 600 cosign.key
47+
echo "$SIGNING_KEY_DATA" > cosign.key
48+
49+
# Ensure cleanup happens even if the script fails
50+
trap 'rm -f cosign.key' EXIT
51+
52+
# Get changed directories
53+
# Use the commits from the push event specifically
54+
CHANGED_DIRS=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep 'zarf.yaml' | xargs -I {} dirname {} | sort -u)
55+
56+
if [ -z "$CHANGED_DIRS" ]; then
57+
echo "No changes detected in Zarf packages."
58+
exit 0
59+
fi
60+
61+
for DIR in $CHANGED_DIRS; do
62+
echo "-------------------------------------------------------"
63+
echo "📦 Building: $DIR"
64+
zarf package create "$DIR" --confirm --output "$DIR"
65+
66+
# Locate the package file
67+
PACKAGE_FILE=$(ls "$DIR"/zarf-package-*.tar.zst)
68+
69+
echo "📦 Signing: $PACKAGE_FILE"
70+
zarf package sign "$PACKAGE_FILE" \
71+
--signing-key cosign.key \
72+
--signing-key-pass "$KEY_PASSWORD" \
73+
--confirm
74+
75+
echo "📦 Publishing: $PACKAGE_FILE"
76+
OCI_PATH_LOWER=$(echo "$OCI_PATH" | tr '[:upper:]' '[:lower:]')
77+
zarf package publish "$PACKAGE_FILE" "oci://$OCI_PATH_LOWER" --confirm
78+
79+
echo "✅ Successfully pushed $PACKAGE_FILE"
80+
done
81+

.github/workflows/lint.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Zarf Packages - Lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**/zarf.yaml'
9+
10+
jobs:
11+
publish-zarf:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Install Zarf
23+
uses: zarf-dev/setup-zarf@v1
24+
with:
25+
version: latest
26+
27+
- name: Lint Changed Packages
28+
env:
29+
SIGNING_KEY_DATA: ${{ secrets.ZARF_SIGNING_KEY }}
30+
KEY_PASSWORD: ${{ secrets.ZARF_KEY_PASSWORD }}
31+
run: |
32+
# Get changed directories
33+
# Use github.base_ref to ensure we compare against the PR's target branch
34+
CHANGED_DIRS=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep 'zarf.yaml' | xargs -I {} dirname {} | sort -u)
35+
36+
if [ -z "$CHANGED_DIRS" ]; then
37+
echo "No changes detected in Zarf packages."
38+
exit 0
39+
fi
40+
41+
for DIR in $CHANGED_DIRS; do
42+
echo "📦 Linting: $DIR"
43+
zarf dev lint "$DIR"
44+
done
45+

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
This repository contains a collection of **Zarf packages** designed to deploy and manage a complete Rocket.Chat ecosystem in air-gapped or restricted environments.
44
Zarf is an open-source tool designed to simplify the delivery of software into air-gapped, secure, or highly regulated environments by bundling all necessary dependencies into [packages](https://docs.zarf.dev/ref/packages/).
55

6+
## Deploying packages
7+
8+
It is recommended that your Kubernetes cluster contains at least 3 nodes with 2 vCPUs, 6 GiB memory and 100G disk each.
9+
For testing, you can decrease storage and mongod limits. There's a README.md in each package folder with variables and defaults.
10+
11+
### Init the cluster
12+
13+
```
14+
KUBECONFIG=<kubeconfig> zarf init [--storage-class longhorn] [--confirm]
15+
```
16+
17+
If there's no reliable storage class in the target cluster, init with what you have, then:
18+
```
19+
KUBECONFIG=<kubeconfig> zarf package deploy zarf-package-rocketchat-longhorn-*.tar.zst --components migrate-registry --confirm # move to longhorn
20+
```
21+
22+
### Deploying
23+
624
Deploy in order:
725
- monitoring (requires a storage class)
826
- traefik
@@ -12,7 +30,7 @@ Deploy in order:
1230
- launchcontrol (requires airlock)
1331
- server-workspace (requires launchcontrol)
1432

15-
## High-level architectural diagram
33+
#### High-level architectural diagram
1634

1735
```mermaid
1836
graph TD
@@ -80,7 +98,7 @@ graph TD
8098

8199
---
82100

83-
## Getting Started
101+
## Developers: Getting Started
84102

85103
Most likely you'll need a lab setup.
86104
There's a guide for developing Zarf packages https://rocketchat.atlassian.net/wiki/spaces/RnD/pages/756842503/Developing+Rocket.Chat+Zarf+packages

traefik/zarf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ variables:
3333
description: "Cloud-specific annotations for Traefik"
3434
default: "{}" # Default to empty for K3s/On-prem, or
3535
# example: zarf package deploy --set LOADBALANCER_SERVICE_ANNOTATIONS='{service.beta.kubernetes.io/aws-load-balancer-type: "nlb"}'
36+

0 commit comments

Comments
 (0)