Skip to content

Commit 1e61f06

Browse files
lilyLuLiuadrianriobo
authored andcommitted
tkn add default value for owner parameters
1 parent e46a2ce commit 1e61f06

20 files changed

Lines changed: 178 additions & 0 deletions

tkn/infra-aws-fedora.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ spec:
6666
Supported values: `PipelineRun`, `TaskRun`.
6767
- name: ownerName
6868
type: string
69+
default: "''"
6970
description: |
7071
The name of the resource that should own the generated SpaceRequest.
7172
This should either be passed the value of `$(context.pipelineRun.name)`
7273
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7374
- name: ownerUid
7475
type: string
76+
default: "''"
7577
description: |
7678
The uid of the resource that should own the generated SpaceRequest.
7779
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -171,6 +173,13 @@ spec:
171173
export AWS_DEFAULT_REGION=$(cat /opt/aws-credentials/region)
172174
BUCKET=$(cat /opt/aws-credentials/bucket)
173175
176+
if [[ $(params.operation) == "create" ]]; then
177+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
178+
echo "Parameter ownerName and ownerUid is required for create instance"
179+
exit 1
180+
fi
181+
fi
182+
174183
# Run mapt
175184
cmd="mapt aws fedora $(params.operation) "
176185
cmd+="--project-name mapt-fedora-$(params.id) "

tkn/infra-aws-kind.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ spec:
6565
Supported values: `PipelineRun`, `TaskRun`.
6666
- name: ownerName
6767
type: string
68+
default: "''"
6869
description: |
6970
The name of the resource that should own the generated SpaceRequest.
7071
This should either be passed the value of `$(context.pipelineRun.name)`
7172
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7273
- name: ownerUid
7374
type: string
75+
default: "''"
7476
description: |
7577
The uid of the resource that should own the generated SpaceRequest.
7678
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -156,6 +158,13 @@ spec:
156158
export AWS_DEFAULT_REGION=$(cat /opt/aws-credentials/region)
157159
BUCKET=$(cat /opt/aws-credentials/bucket)
158160
161+
if [[ $(params.operation) == "create" ]]; then
162+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
163+
echo "Parameter ownerName and ownerUid is required for create instance"
164+
exit 1
165+
fi
166+
fi
167+
159168
# Run mapt
160169
cmd="mapt aws kind $(params.operation) "
161170
cmd+="--project-name kind-$(params.id) "

tkn/infra-aws-mac.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ spec:
6262
Supported values: `PipelineRun`, `TaskRun`.
6363
- name: ownerName
6464
type: string
65+
default: "''"
6566
description: |
6667
The name of the resource that should own the generated SpaceRequest.
6768
This should either be passed the value of `$(context.pipelineRun.name)`
6869
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
6970
- name: ownerUid
7071
type: string
72+
default: "''"
7173
description: |
7274
The uid of the resource that should own the generated SpaceRequest.
7375
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -164,6 +166,13 @@ spec:
164166
export AWS_SECRET_ACCESS_KEY=$(cat /opt/aws-credentials/secret-key)
165167
export AWS_DEFAULT_REGION=$(cat /opt/aws-credentials/region)
166168
BUCKET=$(cat /opt/aws-credentials/bucket)
169+
170+
if [[ $(params.operation) == "create" ]]; then
171+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
172+
echo "Parameter ownerName and ownerUid is required for create instance"
173+
exit 1
174+
fi
175+
fi
167176
168177
# Run mapt
169178
cmd="mapt aws mac $(params.operation) "

tkn/infra-aws-ocp-snc.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ spec:
8282
Supported values: `PipelineRun`, `TaskRun`.
8383
- name: ownerName
8484
type: string
85+
default: "''"
8586
description: |
8687
The name of the resource that should own the generated SpaceRequest.
8788
This should either be passed the value of `$(context.pipelineRun.name)`
8889
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
8990
- name: ownerUid
9091
type: string
92+
default: "''"
9193
description: |
9294
The uid of the resource that should own the generated SpaceRequest.
9395
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -175,6 +177,13 @@ spec:
175177
export AWS_DEFAULT_REGION=$(cat /opt/aws-credentials/region)
176178
BUCKET=$(cat /opt/aws-credentials/bucket)
177179
180+
if [[ $(params.operation) == "create" ]]; then
181+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
182+
echo "Parameter ownerName and ownerUid is required for create instance"
183+
exit 1
184+
fi
185+
fi
186+
178187
# Run mapt
179188
cmd="mapt aws ocp-snc $(params.operation) "
180189
cmd+="--project-name ocp-snc-$(params.id) "

tkn/infra-aws-rhel.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ spec:
8383
Supported values: `PipelineRun`, `TaskRun`.
8484
- name: ownerName
8585
type: string
86+
default: "''"
8687
description: |
8788
The name of the resource that should own the generated SpaceRequest.
8889
This should either be passed the value of `$(context.pipelineRun.name)`
8990
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
9091
- name: ownerUid
9192
type: string
93+
default: "''"
9294
description: |
9395
The uid of the resource that should own the generated SpaceRequest.
9496
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -198,6 +200,13 @@ spec:
198200
export AWS_DEFAULT_REGION=$(cat /opt/aws-credentials/region)
199201
BUCKET=$(cat /opt/aws-credentials/bucket)
200202
203+
if [[ $(params.operation) == "create" ]]; then
204+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
205+
echo "Parameter ownerName and ownerUid is required for create instance"
206+
exit 1
207+
fi
208+
fi
209+
201210
# Run mapt
202211
cmd="mapt aws rhel $(params.operation) "
203212
cmd+="--project-name mapt-rhel-$(params.id) "

tkn/infra-aws-windows-server.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ spec:
6464
Supported values: `PipelineRun`, `TaskRun`.
6565
- name: ownerName
6666
type: string
67+
default: "''"
6768
description: |
6869
The name of the resource that should own the generated SpaceRequest.
6970
This should either be passed the value of `$(context.pipelineRun.name)`
7071
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7172
- name: ownerUid
7273
type: string
74+
default: "''"
7375
description: |
7476
The uid of the resource that should own the generated SpaceRequest.
7577
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -163,6 +165,13 @@ spec:
163165
export AWS_DEFAULT_REGION=$(cat /opt/aws-credentials/region)
164166
BUCKET=$(cat /opt/aws-credentials/bucket)
165167
168+
if [[ $(params.operation) == "create" ]]; then
169+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
170+
echo "Parameter ownerName and ownerUid is required for create instance"
171+
exit 1
172+
fi
173+
fi
174+
166175
# Run mapt
167176
cmd="mapt aws windows $(params.operation) "
168177
cmd+="--project-name mapt-windows-$(params.id) "

tkn/infra-azure-aks.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ spec:
6767
Supported values: `PipelineRun`, `TaskRun`.
6868
- name: ownerName
6969
type: string
70+
default: "''"
7071
description: |
7172
The name of the resource that should own the generated SpaceRequest.
7273
This should either be passed the value of `$(context.pipelineRun.name)`
7374
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7475
- name: ownerUid
7576
type: string
77+
default: "''"
7678
description: |
7779
The uid of the resource that should own the generated SpaceRequest.
7880
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -151,6 +153,12 @@ spec:
151153
export AZURE_STORAGE_KEY=$(cat /opt/az-credentials/storage_key)
152154
BLOB=$(cat /opt/az-credentials/blob)
153155
156+
if [[ $(params.operation) == "create" ]]; then
157+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
158+
echo "Parameter ownerName and ownerUid is required for create instance"
159+
exit 1
160+
fi
161+
fi
154162
155163
# Run mapt
156164
cmd="mapt azure aks $(params.operation) "

tkn/infra-azure-fedora.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ spec:
6767
Supported values: `PipelineRun`, `TaskRun`.
6868
- name: ownerName
6969
type: string
70+
default: "''"
7071
description: |
7172
The name of the resource that should own the generated SpaceRequest.
7273
This should either be passed the value of `$(context.pipelineRun.name)`
7374
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7475
- name: ownerUid
7576
type: string
77+
default: "''"
7678
description: |
7779
The uid of the resource that should own the generated SpaceRequest.
7880
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -162,6 +164,13 @@ spec:
162164
export AZURE_STORAGE_KEY=$(cat /opt/az-credentials/storage_key)
163165
BLOB=$(cat /opt/az-credentials/blob)
164166
167+
if [[ $(params.operation) == "create" ]]; then
168+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
169+
echo "Parameter ownerName and ownerUid is required for create instance"
170+
exit 1
171+
fi
172+
fi
173+
165174
# Run mapt
166175
cmd="mapt azure fedora $(params.operation) "
167176
cmd+="--project-name mapt-fedora-$(params.id) "

tkn/infra-azure-rhel.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ spec:
6767
Supported values: `PipelineRun`, `TaskRun`.
6868
- name: ownerName
6969
type: string
70+
default: "''"
7071
description: |
7172
The name of the resource that should own the generated SpaceRequest.
7273
This should either be passed the value of `$(context.pipelineRun.name)`
7374
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7475
- name: ownerUid
7576
type: string
77+
default: "''"
7678
description: |
7779
The uid of the resource that should own the generated SpaceRequest.
7880
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -166,6 +168,13 @@ spec:
166168
export AZURE_STORAGE_KEY=$(cat /opt/az-credentials/storage_key)
167169
BLOB=$(cat /opt/az-credentials/blob)
168170
171+
if [[ $(params.operation) == "create" ]]; then
172+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
173+
echo "Parameter ownerName and ownerUid is required for create instance"
174+
exit 1
175+
fi
176+
fi
177+
169178
# Run mapt
170179
cmd="mapt azure rhel $(params.operation) "
171180
cmd+="--project-name mapt-rhel-$(params.id) "

tkn/infra-azure-windows-desktop.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ spec:
6767
Supported values: `PipelineRun`, `TaskRun`.
6868
- name: ownerName
6969
type: string
70+
default: "''"
7071
description: |
7172
The name of the resource that should own the generated SpaceRequest.
7273
This should either be passed the value of `$(context.pipelineRun.name)`
7374
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
7475
- name: ownerUid
7576
type: string
77+
default: "''"
7678
description: |
7779
The uid of the resource that should own the generated SpaceRequest.
7880
This should either be passed the value of `$(context.pipelineRun.uid)`
@@ -165,6 +167,13 @@ spec:
165167
export AZURE_STORAGE_KEY=$(cat /opt/az-credentials/storage_key)
166168
BLOB=$(cat /opt/az-credentials/blob)
167169
170+
if [[ $(params.operation) == "create" ]]; then
171+
if [[ $(params.ownerName) == "" || $(params.ownerUid) == "" ]]; then
172+
echo "Parameter ownerName and ownerUid is required for create instance"
173+
exit 1
174+
fi
175+
fi
176+
168177
# Run mapt
169178
cmd="mapt azure windows $(params.operation) "
170179
cmd+="--project-name mapt-windows-$(params.id) "

0 commit comments

Comments
 (0)