Skip to content

Commit

Permalink
Merge pull request #32 from controlplaneio-fluxcd/push-img-manifests
Browse files Browse the repository at this point in the history
Include distro digests in manifests artifact
  • Loading branch information
stefanprodan authored Jun 14, 2024
2 parents 1d8c5fe + b7496ed commit fd31364
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/push-manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs:
- name: Prepare
id: prep
run: |
VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}"
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
VERSION="${{ github.event.inputs.tag }}-$(date +%s)"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
Expand All @@ -49,7 +48,7 @@ jobs:
img_digest=$(flux push artifact \
oci://ghcr.io/controlplaneio-fluxcd/${{ env.CONTROLLER }}-manifests:${{ steps.prep.outputs.VERSION }} \
--path=dist \
--path=disto \
--source=${{ github.repositoryUrl }} \
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" \
--annotations='org.opencontainers.image.description=Flux Operator' \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
img_digest=$(flux push artifact \
oci://ghcr.io/controlplaneio-fluxcd/${{ env.CONTROLLER }}-manifests:${{ steps.prep.outputs.VERSION }} \
--path=dist \
--path=disto \
--source=${{ github.repositoryUrl }} \
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" \
--annotations='org.opencontainers.image.description=Flux Operator' \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
# Go workspace file
go.work
bin/
disto/
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi

.PHONY: build-manifests
build-manifests: ## Generate release manifests.
mkdir -p dist/flux-operator
kustomize build config/default > dist/flux-operator/install.yaml
mkdir -p dist/flux
cp -r config/data/flux/* dist/flux/
hack/build-dist-manifests.sh

##@ Deployment

Expand Down
40 changes: 40 additions & 0 deletions hack/build-dist-manifests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# Copyright 2024 Stefan Prodan.
# SPDX-License-Identifier: AGPL-3.0

set -euo pipefail

REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
DEST_DIR="${REPOSITORY_ROOT}/disto"

info() {
echo '[INFO] ' "$@"
}

fatal() {
echo '[ERROR] ' "$@" >&2
exit 1
}

rm -rf ${DEST_DIR}
mkdir -p ${DEST_DIR}/flux-operator
kustomize build config/default > ${DEST_DIR}/flux-operator/install.yaml
info "operator manifests generated to disto/flux-operator"

mkdir -p ${DEST_DIR}/flux
cp -r config/data/flux/* ${DEST_DIR}/flux/
info "flux manifests copied to disto/flux"

info "downloading distro repository"
curl -sLO https://github.com/controlplaneio-fluxcd/distribution/archive/refs/heads/main.tar.gz
tar xzf main.tar.gz -C "${DEST_DIR}"

mkdir -p "${DEST_DIR}/flux-images"
cp -r ${DEST_DIR}/distribution-main/images/* ${DEST_DIR}/flux-images/
rm -rf ${DEST_DIR}/distribution-main
rm -rf main.tar.gz
info "flux image manifests copied to disto/flux-images"

info "all manifests generated to disto/"
tree -d ${DEST_DIR}

0 comments on commit fd31364

Please sign in to comment.