Skip to content

Commit 481bd22

Browse files
authored
feat: bump DA to latest version (#18)
* feat: add watsonx_admin_api_key as optional input * feat: add watsonx_admin_api_key as optional input * feat: bump DA versions * fix: use_existing_resource_group variable name change * feat: ability to resume failed exec (beta) * feat: ability to resume failed exec (beta)
1 parent a0d1d16 commit 481bd22

File tree

3 files changed

+64
-39
lines changed

3 files changed

+64
-39
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ Click the "Add to project" button, and select create in new project.
3030
"ibmcloud_api_key": "<API Key of the target account with sufficient permissions>",
3131
"resource_group_name": "<target resource group - must be existing in account>",
3232
"region": "<region where resources are deployed>",
33-
"sample_app_git_url": "https://github.com/IBM/gen-ai-rag-watsonx-sample-application"
33+
"sample_app_git_url": "https://github.com/IBM/gen-ai-rag-watsonx-sample-application",
34+
"watsonx_admin_api_key": "<optional - admin key to use for watson if different from ibmcloud_api_key>"
3435
}
3536
}
3637
```
@@ -43,7 +44,8 @@ Example:
4344
"ibmcloud_api_key": "<your api key>",
4445
"resource_group_name": "0411-stack-service-rg",
4546
"region": "eu-de",
46-
"sample_app_git_url": "https://github.com/IBM/gen-ai-rag-watsonx-sample-application"
47+
"sample_app_git_url": "https://github.com/IBM/gen-ai-rag-watsonx-sample-application",
48+
"watsonx_admin_api_key": "<optional - admin key to use for watson if different from ibmcloud_api_key>"
4749
}
4850
}
4951
```

deploy-many.sh

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,39 @@ function set_stack_inputs() {
3939
$CLI_CMD project config-update --project-id $PROJECT_ID --id $STACK_CONFIG_ID --definition @.def.json
4040
}
4141

42+
function get_validation_state() {
43+
if [[ ! -z $DRY_RUN ]]; then
44+
echo "validated"
45+
else
46+
$CLI_CMD project config --project-id $PROJECT_ID --id $CONFIG_ID --output json | jq -r '.state'
47+
fi
48+
}
49+
50+
function get_deployment_state() {
51+
if [[ ! -z $DRY_RUN ]]; then
52+
echo "deployed"
53+
else
54+
$CLI_CMD project config --project-id $PROJECT_ID --id $CONFIG_ID --output json | jq -r ".approved_version.state"
55+
fi
56+
}
57+
4258
function validate_config() {
4359
echo "=========> Starting validation for $(ibmcloud project config --project-id $PROJECT_ID --id $CONFIG_ID --output json| jq -r '.definition.name')"
44-
$CLI_CMD project config-validate --project-id $PROJECT_ID --id $CONFIG_ID --output json > /tmp/validation.json
60+
61+
STATE=$(get_validation_state)
62+
63+
if [[ "$STATE" != "validated" && "$STATE" != "deployed" && "$STATE" != "deploying_failed" ]]; then
64+
$CLI_CMD project config-validate --project-id $PROJECT_ID --id $CONFIG_ID --output json > /tmp/validation.json
65+
fi
4566
}
4667

4768
function wait_for_validation() {
4869
# Loop until the state is set to validated
4970
while true; do
5071

51-
# Get the current state of the configuration
52-
STATE=$(ibmcloud project config --project-id $PROJECT_ID --id $CONFIG_ID --output json | jq -r '.state')
53-
if [[ ! -z $DRY_RUN ]]; then
54-
STATE=validated
55-
fi
72+
STATE=$(get_validation_state)
5673

57-
if [[ "$STATE" == "validated" ]]; then
74+
if [[ "$STATE" == "validated" || "$STATE" == "deployed" || "$STATE" == "deploying_failed" ]]; then
5875
break
5976
fi
6077

@@ -69,24 +86,24 @@ function wait_for_validation() {
6986
}
7087

7188
function approve_config() {
72-
$CLI_CMD project config-approve --project-id $PROJECT_ID --id $CONFIG_ID --comment "I approve through CLI"
89+
if [[ "$STATE" == "validated" ]]; then
90+
$CLI_CMD project config-approve --project-id $PROJECT_ID --id $CONFIG_ID --comment "I approve through CLI"
91+
fi
7392
}
7493

7594
function deploy_config() {
76-
$CLI_CMD project config-deploy --project-id $PROJECT_ID --id $CONFIG_ID
95+
96+
STATE=$(get_deployment_state)
97+
98+
if [[ "$STATE" != "deployed" ]]; then
99+
$CLI_CMD project config-deploy --project-id $PROJECT_ID --id $CONFIG_ID
100+
fi
77101
}
78102

79103
function wait_for_deployment() {
80104
while true; do
81105
# Retrieve the configuration
82-
RESPONSE=$(ibmcloud project config --project-id $PROJECT_ID --id $CONFIG_ID --output json)
83-
84-
# Check the state of the configuration under approved_version
85-
STATE=$(echo "$RESPONSE" | jq -r ".approved_version.state")
86-
if [[ ! -z $DRY_RUN ]]; then
87-
STATE=deployed
88-
fi
89-
106+
STATE=$(get_deployment_state)
90107

91108
# If the state is "deployed" or "deploying_failed", exit the loop
92109
if [[ "$STATE" == "deployed" || "$STATE" == "deploying_failed" ]]; then

stack_definition.json

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"type": "password",
1414
"hidden": false
1515
},
16+
{
17+
"name": "watsonx_admin_api_key",
18+
"required": false,
19+
"type": "password",
20+
"hidden": false
21+
},
1622
{
1723
"name": "resource_group_name",
1824
"required": false,
@@ -61,7 +67,7 @@
6167
"value": "ref:../../inputs/resource_group_name"
6268
},
6369
{
64-
"name": "existing_resource_group",
70+
"name": "use_existing_resource_group",
6571
"value": true
6672
},
6773
{
@@ -73,7 +79,7 @@
7379
"value": "ref:../../inputs/region"
7480
}
7581
],
76-
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.45320da9-fb74-459c-8ebf-0fd70d2c0fc5"
82+
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.24da1d76-8945-4c71-be55-57651e511914"
7783
},
7884
{
7985
"name": "2b - Security Service - Secret Manager",
@@ -90,10 +96,6 @@
9096
"name": "region",
9197
"value": "ref:../../inputs/region"
9298
},
93-
{
94-
"name": "resource_group_name",
95-
"value": "ref:../../inputs/resource_group_name"
96-
},
9799
{
98100
"name": "existing_kms_guid",
99101
"value": "ref:../2a - Security Service - Key Management/outputs/kms_guid"
@@ -103,7 +105,7 @@
103105
"value": true
104106
}
105107
],
106-
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.1019a9f9-3d14-439d-a328-ea990e481fb0"
108+
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.ebffb17b-302a-4f12-925c-16c4e6a590c2"
107109
},
108110
{
109111
"name": "2c - Security Service - Security Compliance Center",
@@ -125,15 +127,15 @@
125127
"value": "ref:../../inputs/resource_group_name"
126128
},
127129
{
128-
"name": "existing_kms_guid",
129-
"value": "ref:../2a - Security Service - Key Management/outputs/kms_guid"
130+
"name": "existing_kms_instance_crn",
131+
"value": "ref:../2a - Security Service - Key Management/outputs/key_protect_crn"
130132
},
131133
{
132-
"name": "existing_resource_group",
134+
"name": "use_existing_resource_group",
133135
"value": true
134136
}
135137
],
136-
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.9cd00e0b-4b0a-482a-8974-8581d27da09f"
138+
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.2c901854-5628-4d48-9edf-395e22ca47d2"
137139
},
138140
{
139141
"name": "3 - Observability - Logging Monitoring Activity Tracker",
@@ -146,27 +148,31 @@
146148
"name": "region",
147149
"value": "ref:../../inputs/region"
148150
},
151+
{
152+
"name": "existing_kms_instance_crn",
153+
"value": "ref:../2a - Security Service - Key Management/outputs/key_protect_crn"
154+
},
149155
{
150156
"name": "resource_group_name",
151157
"value": "ref:../../inputs/resource_group_name"
152158
},
153159
{
154-
"name": "existing_kms_guid",
155-
"value": "ref:../2a - Security Service - Key Management/outputs/kms_guid"
156-
},
157-
{
158-
"name": "existing_resource_group",
160+
"name": "use_existing_resource_group",
159161
"value": true
160162
}
161163
],
162-
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.fb52a84e-5ce4-4c5c-86ef-2adc4271107c"
164+
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.7d068949-1aa6-4fb0-bb47-5fa062851810"
163165
},
164166
{
165167
"inputs": [
166168
{
167169
"name": "ibmcloud_api_key",
168170
"value": "ref:../../inputs/ibmcloud_api_key"
169171
},
172+
{
173+
"name": "watsonx_admin_api_key",
174+
"value": "ref:../../inputs/watsonx_admin_api_key"
175+
},
170176
{
171177
"name": "resource_group_name",
172178
"value": "ref:../../inputs/resource_group_name"
@@ -209,7 +215,7 @@
209215
}
210216
],
211217
"name": "4 - WatsonX SaaS services",
212-
"version_locator": "8bfb1293-8b85-4d3f-a89f-015d0a0719df.89584910-8375-4c44-8c3b-65ddc553c3b2"
218+
"version_locator": "8bfb1293-8b85-4d3f-a89f-015d0a0719df.bcbb2267-a849-426b-9132-c4b47b259d81"
213219
},
214220
{
215221
"inputs": [
@@ -287,7 +293,7 @@
287293
}
288294
],
289295
"name": "5 - Generative AI Sample App - Code Engine Toolchain Config",
290-
"version_locator": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.541b6240-1c09-455d-83c2-cbcc4a45af37-global"
296+
"version_locator": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc.c5f85486-df86-4b97-b44e-0d5070b8e935-global"
291297
},
292298
{
293299
"inputs": [
@@ -353,7 +359,7 @@
353359
}
354360
],
355361
"name": "6 - Sample RAG app configuration",
356-
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.19041420-5bc9-4aca-9dc8-0cb432c80962"
362+
"version_locator": "7df1e4ca-d54c-4fd0-82ce-3d13247308cd.c63ae996-38a8-4756-90cb-a3d9d39ee008"
357363
}
358364
]
359365
}

0 commit comments

Comments
 (0)