-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SPSTRAT-465): add task for marketplacesvm
This commit introduces a new task named `marketplaces-push-disk-images` which will be used to deliver disk images to various cloud marketplaces using the `marketplacesvm_push_wrapper`. Signed-off-by: Jonathan Gangi <jgangi@redhat.com>
- Loading branch information
Showing
11 changed files
with
624 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
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,9 @@ | ||
# collect-marketplacesvm-secret | ||
|
||
Tekton task that collects the secret for the cloud marketplaces from the data file | ||
|
||
## Parameters | ||
|
||
| Name | Description | Optional | Default value | | ||
|--------------|------------------------------------------------------------------|----------|---------------| | ||
| dataPath | Path to the merged data JSON file generated by collect-data task | No | - | |
44 changes: 44 additions & 0 deletions
44
tasks/collect-marketplacesvm-secret/collect-marketplacesvm-secret.yaml
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,44 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Task | ||
metadata: | ||
name: collect-marketplaces-secret | ||
labels: | ||
app.kubernetes.io/version: "0.1.0" | ||
annotations: | ||
tekton.dev/pipelines.minVersion: "0.12.1" | ||
tekton.dev/tags: release | ||
spec: | ||
description: >- | ||
Tekton task that collects the secret for the cloud marketplaces from the data file | ||
params: | ||
- name: dataPath | ||
type: string | ||
description: Path to the merged data JSON file generated by collect-data task | ||
workspaces: | ||
- name: data | ||
description: The workspace where the data json file resides | ||
results: | ||
- name: cloudMarketplacesSecret | ||
type: string | ||
description: "The base64 encoded secret to use for various cloud marketplaces." | ||
steps: | ||
- name: collect-marketplacesvm-secret | ||
image: | ||
quay.io/konflux-ci/release-service-utils:7f7a156a835c773bbcd7e5d7e44df2f573db14f2 | ||
script: | | ||
#!/usr/bin/env bash | ||
set -eux | ||
DATA_FILE="$(workspaces.data.path)/$(params.dataPath)" | ||
if [ ! -f "${DATA_FILE}" ] ; then | ||
echo "No valid data file was provided." | ||
exit 1 | ||
fi | ||
if [ "$(jq '.mapping | has("cloudMarketplacesSecret")' "$DATA_FILE")" == false ] ; then | ||
echo "Marketplaces secret missing in data JSON file" | ||
exit 1 | ||
fi | ||
jq -j '.mapping.cloudMarketplacesSecret' "$DATA_FILE" | tee "$(results.cloudMarketplacesSecret.path)" |
53 changes: 53 additions & 0 deletions
53
tasks/collect-marketplacesvm-secret/tests/test-collect-marketplacesvm-no-secret.yaml
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,53 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-collect-marketplaces-secret-fail-no-secret | ||
annotations: | ||
test/assert-task-failure: "run-task" | ||
spec: | ||
description: | | ||
Run the collect-marketplaces-secret task with no secret in the data file and | ||
verify the task fails as expected | ||
workspaces: | ||
- name: tests-workspace | ||
tasks: | ||
- name: setup | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: setup-values | ||
image: quay.io/konflux-ci/release-service-utils:7f7a156a835c773bbcd7e5d7e44df2f573db14f2 | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eux | ||
cat > $(workspaces.data.path)/data.json << EOF | ||
{ | ||
"mapping": { | ||
"components": [ | ||
{ | ||
"name": "mycomponent" | ||
} | ||
], | ||
"defaults": { | ||
"public": true | ||
} | ||
} | ||
} | ||
EOF | ||
- name: run-task | ||
taskRef: | ||
name: collect-marketplaces-secret | ||
params: | ||
- name: dataPath | ||
value: data.json | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
runAfter: | ||
- setup |
22 changes: 22 additions & 0 deletions
22
.../collect-marketplacesvm-secret/tests/test-collect-marketplacesvm-secret-fail-no-data.yaml
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,22 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-collect-marketplaces-secret-fail-no-data | ||
annotations: | ||
test/assert-task-failure: "run-task" | ||
spec: | ||
description: | | ||
Run the test-collect-marketplaces-secret task with no data file and verify the taks fails as expected | ||
workspaces: | ||
- name: tests-workspace | ||
tasks: | ||
- name: run-task | ||
taskRef: | ||
name: collect-marketplaces-secret | ||
params: | ||
- name: dataPath | ||
value: data.json | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace |
72 changes: 72 additions & 0 deletions
72
tasks/collect-marketplacesvm-secret/tests/test-collect-marketplacesvm-secret.yaml
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,72 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: test-collect-marketplaces-secret | ||
spec: | ||
description: | | ||
Run the collect-marketplaces-secret task with the secret required and verify that | ||
it will return the secret string. | ||
workspaces: | ||
- name: tests-workspace | ||
tasks: | ||
- name: setup | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
taskSpec: | ||
workspaces: | ||
- name: data | ||
steps: | ||
- name: setup-values | ||
image: quay.io/konflux-ci/release-service-utils:7f7a156a835c773bbcd7e5d7e44df2f573db14f2 | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eux | ||
cat > $(workspaces.data.path)/data.json << EOF | ||
{ | ||
"mapping": { | ||
"components": [ | ||
{ | ||
"name": "mycomponent1" | ||
}, | ||
{ | ||
"name": "mycomponent2", | ||
"public": true | ||
} | ||
], | ||
"defaults": {}, | ||
"cloudMarketplacesSecret": "eyJ0ZXN0Ijoic2VjcmV0In0K" | ||
} | ||
} | ||
EOF | ||
- name: run-task | ||
taskRef: | ||
name: collect-marketplaces-secret | ||
params: | ||
- name: dataPath | ||
value: data.json | ||
workspaces: | ||
- name: data | ||
workspace: tests-workspace | ||
runAfter: | ||
- setup | ||
- name: check-result | ||
params: | ||
- name: secret | ||
value: $(tasks.run-task.results.cloudMarketplacesSecret) | ||
taskSpec: | ||
params: | ||
- name: secret | ||
steps: | ||
- name: check-result | ||
image: quay.io/konflux-ci/release-service-utils:7f7a156a835c773bbcd7e5d7e44df2f573db14f2 | ||
env: | ||
- name: "SECRET" | ||
value: '$(params.secret)' | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eux | ||
test "$SECRET" = "eyJ0ZXN0Ijoic2VjcmV0In0K" |
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,14 @@ | ||
# marketplaces-push-disk-images | ||
|
||
Tekton Task to publish VM disk images into various cloud marketplaces using `pubtools-marketplacesvm`. | ||
|
||
It currently supports images in `raw` and `vhd` formats for `AWS` and `Azure` respectively. | ||
|
||
## Parameters | ||
|
||
| Name | Description | Optional | Default value | | ||
| ----------------------- | -------------------------------------------------------------------------------------- | -------- | --------------- | | ||
| snapshotPath | Path to the JSON string of the mapped snapshot spec in the data workspace. | No | - | | ||
| dataPath | Path to the data JSON in the workspace containing the marketplacesvm options to use. | No | - | | ||
| cloudMarketplacesSecret | Env specific secret containing the marketplaces credentials. | No | - | | ||
| concurrentLimit | The maximum number of images to be pulled at once. | Yes | 3 | |
Oops, something went wrong.