Skip to content

Commit

Permalink
Add pull-from and generate-pull-from-matrix actions
Browse files Browse the repository at this point in the history
Using one after the other should make creating a pull resources
workflow very smooth.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Jan 26, 2024
1 parent e371758 commit d6fb45b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
30 changes: 30 additions & 0 deletions actions/generate-pull-from-matrix/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Generate `pull-from` matrix output
description: |
Generates a GitHub Worklow outputs that can then be consumed with `strategy.matrix` from an `externals.yaml` file.
inputs:
version:
description: 'Version of catalog-cd to install (tip, latest-release, v0.1.0, etc.)'
require: false
default: 'latest-release'
externals:
description: |
Path to the `externals.yaml` file
required: true
default: ./externals.yaml
outputs:
pull-from-list:
description: |
`stragety.matrix` compatible output containing the "matrix" of pull-from to run.
runs:
using: composite
steps:
- uses: openshift-pipelines/catalog-cd/actions/setup-catalog-cd
with:
version: ${{ inputs.version }}
- id: set-matrix
name: Generate catalog matrix
run: |
set -Eeu
echo "pull-from-list=$(catalog-cd catalog externals --config ./externals.yaml)" >> "$GITHUB_OUTPUT"
cat "$GITHUB_OUTPUT"
47 changes: 47 additions & 0 deletions actions/pull-from/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Generate `pull-from` matrix output
description: |
Generates a GitHub Worklow outputs that can then be consumed with `strategy.matrix` from an `externals.yaml` file.
inputs:
version:
description: 'Version of catalog-cd to install (tip, latest-release, v0.1.0, etc.)'
require: false
default: 'latest-release'
name:
description: 'Name of the repository we pull'
required: true
url:
description: 'URL of the repository we pull'
required: true
type:
description: 'Type of resources we pull'
required: true
default: 'task'
ignoreVersions:
description: 'Versions to ignore'
required: 'true'
default: ''
target:
description: 'The path where catalog-cd will write the resources pulled'
required: true
default: .
outputs:
pull-from-list:
description: |
`stragety.matrix` compatible output containing the "matrix" of pull-from to run.
runs:
using: composite
steps:
- uses: openshift-pipelines/catalog-cd/actions/setup-catalog-cd
with:
version: ${{ inputs.version }}
- id: set-matrix
name: Generate catalog matrix
run: |
set -Eeu
catalog-cd catalog generate-from \
--name ${{ inputs.name }} \
--url ${{ inputs.url }} \
--type ${{ inputs.type }} \
--ignore-versions "${{ inputs.ignoreVersions }}" \
${{ inputs.target }}

0 comments on commit d6fb45b

Please sign in to comment.