Skip to content

Commit

Permalink
chore: use one list for components
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobmoellerdev committed Nov 5, 2024
1 parent 19cf23d commit bd69df5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/components.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: component CTFs
name: Components

on:
pull_request:
Expand All @@ -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
Expand Down Expand Up @@ -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/[email protected]
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit bd69df5

Please sign in to comment.