From bd69df5e730bc3c4e7c8598739909cc6e2a8a0c8 Mon Sep 17 00:00:00 2001 From: jakobmoellerdev Date: Tue, 5 Nov 2024 12:18:34 +0100 Subject: [PATCH] chore: use one list for components --- .github/workflows/components.yaml | 38 +++++++++++++++++++++++-------- Makefile | 8 +++++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/components.yaml b/.github/workflows/components.yaml index 49fcc4ad5c..32e5687cd1 100644 --- a/.github/workflows/components.yaml +++ b/.github/workflows/components.yaml @@ -1,4 +1,4 @@ -name: component CTFs +name: Components on: pull_request: @@ -12,14 +12,27 @@ permissions: pull-requests: read env: - CTF_TYPE: directory + components: '["ocmcli", "helminstaller", "helmdemo", "subchartsdemo", "ecrplugin"]' jobs: + define-matrix: + runs-on: ubuntu-latest + outputs: + components: ${{ steps.componentMatrix.outputs.matrix }} + steps: + - id: componentMatrix + name: Set Components to be used for Build + run: | + echo "matrix=$input" >> $GITHUB_OUTPUT + env: + input: ${{ env.components }} + build: name: "Build" + needs: define-matrix strategy: matrix: - component: [ocmcli, helminstaller, helmdemo, subchartsdemo, ecrplugin] + component: ${{fromJSON(needs.define-matrix.outputs.components)}} runs-on: large_runner steps: - name: Self Hosted Runner Post Job Cleanup Action @@ -65,11 +78,11 @@ jobs: path: gen/${{ matrix.component }}/ctf aggregate: - name: "Aggregate Build Artifacts" + name: "Aggregate" runs-on: large_runner - needs: build + needs: [build, define-matrix] env: - components: ocmcli helminstaller helmdemo subchartsdemo ecrplugin + components: ${{ join(fromJSON(needs.define-matrix.outputs.components), ' ') }} steps: - name: Self Hosted Runner Post Job Cleanup Action uses: TooMuch4U/actions-clean@v2.2 @@ -115,15 +128,20 @@ jobs: done - name: Create aggregated CTF run: | - PATH=$PATH:$(go env GOPATH)/bin CTF_TYPE=${{ env.CTF_TYPE }} COMPONENTS="${{ env.components }}" make plain-ctf + PATH=$PATH:$(go env GOPATH)/bin \ + CTF_TYPE=${{ env.CTF_TYPE }} \ + COMPONENTS="${{ env.components }}" \ + make plain-ctf descriptor describe + env: + CTF_TYPE: directory - name: Upload aggregated CTF - # only update on main - if: github.ref == 'refs/heads/main' + # only upload the artifact if we are not on a PR + if: needs.pr-check.outputs.number != 'null' uses: actions/upload-artifact@v4 with: if-no-files-found: error overwrite: true - retention-days: 90 + retention-days: 60 name: ctf-aggregated path: gen/ctf - name: Delete old CTFs that lead up to aggregation diff --git a/Makefile b/Makefile index 01e3e18afd..405434ff37 100644 --- a/Makefile +++ b/Makefile @@ -174,6 +174,14 @@ $(GEN)/ctf: $(GEN)/.exists $(GEN)/.comps bin/ocm done @touch $@ +.PHONY: describe +describe: $(GEN)/ctf bin/ocm + $(OCM) get resources --lookup $(OCMREPO) -r -o treewide $(GEN)/ctf + +.PHONY: descriptor +descriptor: $(GEN)/ctf bin/ocm + $(OCM) get component -S v3alpha1 -o yaml $(GEN)/ctf + .PHONY: push push: $(GEN)/ctf $(GEN)/.push.$(NAME)