Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RHTAPREL-119): remove lingering extraData references #243

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions tasks/run-file-updates/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# run-file-udpates

Tekton task to create InternalRequests for each repository that needs to be updated. This information is extracted from
the field `spec.extraData.fileUpdates` in the ReleasePlanAdmission resource.
the field `spec.data.fileUpdates` in the ReleasePlanAdmission resource.

## Parameters

| Name | Description | Optional | Default value |
|-----------------|---------------------------------------------------------------|----------|-------------------------------|
| jsonKey | JSON key where the information is defined | Yes | .spec.extraData.fileUpdates[] |
| fileUpdatesPath | Path to the JSON file containing the key | No | |
| snapshotPath | Path to the JSON string of the Snapshot spec in the data workspace | No | snapshot_spec.json |
| request | Type of request to be created | Yes | file-updates |
| synchronously | Whether the task should wait for InternalRequests to complete | Yes | true |
| Name | Description | Optional | Default value |
|-----------------|--------------------------------------------------------------------|----------|--------------------------|
| jsonKey | JSON key where the information is defined | Yes | .spec.data.fileUpdates[] |
| fileUpdatesPath | Path to the JSON file containing the key | No | |
| snapshotPath | Path to the JSON string of the Snapshot spec in the data workspace | No | snapshot_spec.json |
| request | Type of request to be created | Yes | file-updates |
| synchronously | Whether the task should wait for InternalRequests to complete | Yes | true |

## Changelog

### Changes since 0.4.1
- jsonKey default changed to .spec.data.fileUpdates{} due to API changes

### changes since 0.3
- update Tekton API to v1

Expand Down
4 changes: 2 additions & 2 deletions tasks/run-file-updates/run-file-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Task
metadata:
name: run-file-updates
labels:
app.kubernetes.io/version: "0.4.1"
app.kubernetes.io/version: "0.5.0"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand All @@ -15,7 +15,7 @@ spec:
- name: jsonKey
type: string
description: The json key containing the file updates
default: ".spec.extraData.fileUpdates"
default: ".spec.data.fileUpdates"
- name: fileUpdatesPath
type: string
description: The path to the file containing the file updates
Expand Down
10 changes: 5 additions & 5 deletions tasks/run-file-updates/tests/test-run-file-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
application: foo
origin: foo
releaseStrategy: foo
extraData:
data:
fileUpdates:
- repo: https://gitlab.cee.redhat.com/foo
paths:
Expand Down Expand Up @@ -106,7 +106,7 @@ spec:
application=$(jq -r '.application' $(workspaces.data.path)/snapshot_spec.json)

# Parse the input json file
fileUpdates=$(jq -r '.spec.extraData.fileUpdates | length' "$(workspaces.data.path)/rpa.json")
fileUpdates=$(jq -r '.spec.data.fileUpdates | length' "$(workspaces.data.path)/rpa.json")

# Fetch all the InternalRequest resources
allRequests=$(kubectl get InternalRequest -o json)
Expand All @@ -124,13 +124,13 @@ spec:
i=0
while [ "$i" -lt "$fileUpdates" ]
do
repo=$(jq -r --argjson i "$i" '.spec.extraData.fileUpdates[$i].repo' \
repo=$(jq -r --argjson i "$i" '.spec.data.fileUpdates[$i].repo' \
"$(workspaces.data.path)/rpa.json")
paths=$(jq -r --argjson i "$i" '.spec.extraData.fileUpdates[$i].paths' \
paths=$(jq -r --argjson i "$i" '.spec.data.fileUpdates[$i].paths' \
"$(workspaces.data.path)/rpa.json")

# Check if ref is present in the input file. If not, set it to 'main'
ref=$(jq -r --argjson i "$i" '.spec.extraData.fileUpdates[$i].ref // "main"' \
ref=$(jq -r --argjson i "$i" '.spec.data.fileUpdates[$i].ref // "main"' \
"$(workspaces.data.path)/rpa.json")

# check if requestApplication is correct
Expand Down