6262 type : string
6363 default : " ReadWriteMany"
6464 tasks :
65- - name : add-namespace
66- taskRef :
67- kind : Task
68- name : ibm-pak
69- params :
70- - name : SCRIPT
71- value : |
72- oc apply -f - <<EOF
73- kind: Namespace
74- apiVersion: v1
75- metadata:
76- name: $(params.namespace)
77- EOF
78- - name : get-maximo-licensefile
79- workspaces :
80- - name : ws
81- params :
82- - name : KEY_ID
83- value : 0ae3295c-95dd-c323-82af-1be5587d998f
84- - name : SECRETS_MANAGER_ENDPOINT_URL
85- value : >-
86- https://afa20521-cd75-4864-843f-e59fd0ffd49d.us-south.secrets-manager.appdomain.cloud
87- - name : LICENSE_FILE_SECRET_NAME
88- value : " $(params.license-file-secret-name)"
89- taskSpec :
90- workspaces :
91- - name : ws
92- params :
93- - name : KEY_ID
94- - name : SECRETS_MANAGER_ENDPOINT_URL
95- - name : LICENSE_FILE_SECRET_NAME
96- steps :
97- - name : write-maximo-licensefile
98- image : quay.io/openshift/origin-cli:4.10
99- script : |
100- #!/usr/bin/env bash
101-
102- if [[ $(params.LICENSE_FILE_SECRET_NAME) == "false" ]]; then
103- # Retrieve the IBM Cloud API Key configured in a `deployer` cluster
104- export IBMCLOUD_API_KEY=$(oc get secret ibm-secret -n kube-system -o jsonpath='{.data.apiKey}' | base64 -d)
105- export AUTH_RESPONSE_JSON=$(curl -s -X POST \
106- "https://iam.cloud.ibm.com/identity/token" \
107- --header 'Content-Type: application/x-www-form-urlencoded' \
108- --header 'Accept: application/json' \
109- --data-urlencode 'grant_type=urn:ibm:params:oauth:grant-type:apikey' \
110- --data-urlencode "apikey=${IBMCLOUD_API_KEY}")
111- export ACCESS_TOKEN=$(echo $AUTH_RESPONSE_JSON | grep -o '"access_token":"[^"]*' | grep -o '[^"]*$')
112- export SECRET_JSON=$(curl -s -X GET --location --header "Authorization: Bearer ${ACCESS_TOKEN}" --header "Accept: application/json" "$(params.SECRETS_MANAGER_ENDPOINT_URL)/api/v2/secrets/$(params.KEY_ID)")
113- echo $SECRET_JSON | grep -o '"payload":"[^"]*' | grep -o '[^"]*$' | base64 -d > $(workspaces.ws.path)/license.dat
114-
115- else
116- oc get secret $(params.LICENSE_FILE_SECRET_NAME) -n kube-system -o jsonpath='{.data.apiKey}' | base64 -d > $(workspaces.ws.path)/license.dat
117- fi
118-
119- cat $(workspaces.ws.path)/license.dat
12065 - name : get-ibm-entitlement-key
12166 taskRef :
12267 name : ibmcloud-secrets-manager-get
@@ -135,51 +80,94 @@ spec:
13580 runAfter :
13681 - get-ibm-entitlement-key
13782 params :
138- - name : entitlement-key
83+ - name : retrieved- entitlement-key
13984 value : $(tasks.get-ibm-entitlement-key.results.secret-value)
14085 workspaces :
14186 - name : ws
14287 taskSpec :
14388 workspaces :
14489 - name : ws
14590 params :
146- - name : entitlement-key
91+ - name : retrieved- entitlement-key
14792 steps :
14893 - name : set-entitlement-key
14994 image : quay.io/openshift/origin-cli:4.10
15095 script : |
15196 #!/usr/bin/env bash
152- echo $(params.entitlement-key) > $(workspaces.ws.path)/ek.dat
97+ echo $(params.retrieved- entitlement-key) > $(workspaces.ws.path)/ek.dat
15398 echo "ek.dat created"
15499 exit
155100 - name : set-provided-entitlement-key
156101 workspaces :
157102 - name : ws
158- when :
159- - input : " $(params.ibm-entitlement-key)"
160- operator : notin
161- values : ["false"]
103+ # when:
104+ # - input: "$(params.ibm-entitlement-key)"
105+ # operator: notin
106+ # values: ["false"]
162107 params :
163- - name : ibm -entitlement-key
108+ - name : provided -entitlement-key
164109 value : " $(params.ibm-entitlement-key)"
165110 taskSpec :
166111 workspaces :
167112 - name : ws
168113 params :
169- - name : ibm -entitlement-key
114+ - name : provided -entitlement-key
170115 steps :
171116 - name : set-entitlement
172117 image : quay.io/openshift/origin-cli:4.10
173118 script : |
174119 #!/usr/bin/env bash
175- echo $(params.ibm -entitlement-key) > $(workspaces.ws.path)/ek.dat
120+ echo $(params.provided -entitlement-key) > $(workspaces.ws.path)/ek.dat
176121 echo "ek.dat created"
177122 exit
178- - name : install-mas
123+ - name : get-maximo-licensefile
124+ workspaces :
125+ - name : ws
179126 runAfter :
180- - get-maximo-licensefile
181127 - set-provided-entitlement-key
182128 - set-retrieved-entitlement-key
129+ params :
130+ - name : KEY_ID
131+ value : 0ae3295c-95dd-c323-82af-1be5587d998f
132+ - name : SECRETS_MANAGER_ENDPOINT_URL
133+ value : >-
134+ https://afa20521-cd75-4864-843f-e59fd0ffd49d.us-south.secrets-manager.appdomain.cloud
135+ - name : LICENSE_FILE_SECRET_NAME
136+ value : " $(params.license-file-secret-name)"
137+ taskSpec :
138+ workspaces :
139+ - name : ws
140+ params :
141+ - name : KEY_ID
142+ - name : SECRETS_MANAGER_ENDPOINT_URL
143+ - name : LICENSE_FILE_SECRET_NAME
144+ steps :
145+ - name : write-maximo-licensefile
146+ image : quay.io/openshift/origin-cli:4.10
147+ script : |
148+ #!/usr/bin/env bash
149+
150+ if [[ $(params.LICENSE_FILE_SECRET_NAME) == "false" ]]; then
151+ # Retrieve the IBM Cloud API Key configured in a `deployer` cluster
152+ export IBMCLOUD_API_KEY=$(oc get secret ibm-secret -n kube-system -o jsonpath='{.data.apiKey}' | base64 -d)
153+ export AUTH_RESPONSE_JSON=$(curl -s -X POST \
154+ "https://iam.cloud.ibm.com/identity/token" \
155+ --header 'Content-Type: application/x-www-form-urlencoded' \
156+ --header 'Accept: application/json' \
157+ --data-urlencode 'grant_type=urn:ibm:params:oauth:grant-type:apikey' \
158+ --data-urlencode "apikey=${IBMCLOUD_API_KEY}")
159+ export ACCESS_TOKEN=$(echo $AUTH_RESPONSE_JSON | grep -o '"access_token":"[^"]*' | grep -o '[^"]*$')
160+ export SECRET_JSON=$(curl -s -X GET --location --header "Authorization: Bearer ${ACCESS_TOKEN}" --header "Accept: application/json" "$(params.SECRETS_MANAGER_ENDPOINT_URL)/api/v2/secrets/$(params.KEY_ID)")
161+ echo $SECRET_JSON | grep -o '"payload":"[^"]*' | grep -o '[^"]*$' | base64 -d > $(workspaces.ws.path)/license.dat
162+
163+ else
164+ oc get secret $(params.LICENSE_FILE_SECRET_NAME) -n default -o jsonpath='{.data.licensefile}' | base64 -d | base64 -d > $(workspaces.ws.path)/license.dat
165+ fi
166+
167+ cat $(workspaces.ws.path)/license.dat
168+ - name : install-mas
169+ runAfter :
170+ - get-maximo-licensefile
183171 workspaces :
184172 - name : ws
185173 params :
@@ -211,7 +199,6 @@ spec:
211199 workspaces :
212200 - name : ws
213201 params :
214- - name : ibm-entitlement-key
215202 - name : mas-instance-id
216203 - name : mas-workspace-id
217204 - name : mas-workspace-name
0 commit comments