-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pull-from and generate-pull-from-matrix actions
Using one after the other should make creating a pull resources workflow very smooth. Signed-off-by: Vincent Demeester <[email protected]>
- Loading branch information
1 parent
e371758
commit d6fb45b
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |