Skip to content

Commit

Permalink
feat: add support for building and pushing OCI configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Marttinen <[email protected]>
  • Loading branch information
twelho committed Jul 26, 2023
1 parent 0ecc540 commit faffb23
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/oci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
# TODO: Change to main merges
pull_request:

name: OCI
jobs:
push:
name: Push
runs-on: ubuntu-latest
container:
image: fluxcd/flux-cli:v2.0.1
options: --user root
steps:
- name: Install dependencies
run: apk --no-cache add docker git make
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check out sources
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Mark sources as safe for Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build and push OCI artifacts
run: make push-all
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
all: build-metrics

build-metrics:
build-all: build-metrics
push-all: push-metrics

build-%:
test -d "$*"
mkdir -p out
kustomize build --enable-helm "$*" > "out/$*.yaml"

push-%:
# Push manifests to GHCR using the short Git SHA as the OCI artifact tag
flux push artifact "oci://ghcr.io/testk8s-platform/$*:$(shell git rev-parse --short HEAD)" \
--path="$*" \
--source="$(shell git config --get remote.origin.url)" \
--revision="$(shell git branch --show-current)@sha1:$(shell git rev-parse HEAD)"

update-observability:
curl -sSL https://raw.githubusercontent.com/cilium/cilium/main/examples/kubernetes/addons/prometheus/monitoring-example.yaml > base/cilium-observability/manifest.gen.yaml

.PHONY: build-all push-all $(filter build-%,$(MAKECMDGOALS)) $(filter push-%,$(MAKECMDGOALS)) update-observability

0 comments on commit faffb23

Please sign in to comment.