Skip to content

Commit 6bd0c0a

Browse files
authored
PHP-102055: Fix access token retrieval URL (#264)
PHP-102055: Fix access token retrieval URL Remove staging refs
1 parent bc464c9 commit 6bd0c0a

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

startupscript/butane/004-git-clone-devcontainer.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ if [[ $# -lt 1 ]]; then
1717
usage
1818
fi
1919

20+
21+
# Map the server to appropriate service path
22+
function get_service_url() {
23+
case "$1" in
24+
"dev-stable") echo "https://workbench-dev.verily.com/api/$2" ;;
25+
"dev-unstable") echo "https://workbench-dev-unstable.verily.com/api/$2" ;;
26+
"test") echo "https://workbench-test.verily.com/api/$2" ;;
27+
"prod") echo "https://workbench.verily.com/api/$2" ;;
28+
*) return 1 ;;
29+
esac
30+
}
31+
readonly -f get_service_url
32+
2033
source /home/core/metadata-utils.sh
2134

2235
# To accommodate the use of SSH URLs for public Git repositories, set the following Git configuration:
@@ -44,11 +57,21 @@ api_url="${api_url%.git}"
4457
# Check if repo is private
4558
private_status=$(curl --retry 5 -s "${api_url}" | jq -r ".status")
4659
if [[ "${PRIVATE_DEVCONTAINER_ENABLED}" == "TRUE" && "${private_status}" == 404 ]]; then
60+
# Get ECM service URL
61+
SERVER="$(get_metadata_value "terra-cli-server" "")"
62+
readonly SERVER
63+
if [[ -z "${SERVER}" ]]; then
64+
SERVER="prod"
65+
fi
66+
if ! ECM_SERVICE_URL="$(get_service_url "${SERVER}" "ecm")"; then
67+
exit 1
68+
fi
69+
4770
# disable logs to not expose access token
4871
set +o xtrace
4972

5073
# Retrieve GitHub access token
51-
response=$(curl https://workbench-dev.verily.com/api/ecm/api/oauth/v1/github/access-token \
74+
response=$(curl "${ECM_SERVICE_URL}/api/oauth/v1/github/access-token" \
5275
-w "\n%{http_code}" \
5376
-H "Authorization: Bearer $(/home/core/wb.sh auth print-access-token)")
5477
http_code=$(echo "${response}" | tail -n1)

startupscript/dataproc/startup.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ function get_service_url() {
202202
"dev-stable") echo "https://workbench-dev.verily.com/api/$2" ;;
203203
"dev-unstable") echo "https://workbench-dev-unstable.verily.com/api/$2" ;;
204204
"test") echo "https://workbench-test.verily.com/api/$2" ;;
205-
"staging") echo "https://workbench-staging.verily.com/api/$2" ;;
206205
"prod") echo "https://workbench.verily.com/api/$2" ;;
207206
*) return 1 ;;
208207
esac
@@ -231,7 +230,7 @@ function get_ui_uri() {
231230
echo "https://workbench.verily.com"
232231
elif [[ "${env}" == "dev-stable" ]]; then
233232
echo "https://workbench-dev.verily.com"
234-
elif [[ "${env}" == "dev-unstable" || "${env}" == "test" || "${env}" == "staging" ]]; then
233+
elif [[ "${env}" == "dev-unstable" || "${env}" == "test" ]]; then
235234
echo "https://workbench-${env}.verily.com"
236235
else
237236
echo "https://workbench.verily.com"

startupscript/install-cli.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function get_axon_version_url() {
2929
"dev-stable") echo "https://workbench-dev.verily.com/api/axon/version" ;;
3030
"dev-unstable") echo "https://workbench-dev-unstable.verily.com/api/axon/version" ;;
3131
"test") echo "https://workbench-test.verily.com/api/axon/version" ;;
32-
"staging") echo "https://workbench-staging.verily.com/api/axon/version" ;;
3332
"prod") echo "https://workbench.verily.com/api/axon/version" ;;
3433
*) return 1 ;;
3534
esac

startupscript/vertex-ai-user-managed-notebook/post-startup.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ function get_service_url() {
238238
"dev-stable") echo "https://workbench-dev.verily.com/api/$2" ;;
239239
"dev-unstable") echo "https://workbench-dev-unstable.verily.com/api/$2" ;;
240240
"test") echo "https://workbench-test.verily.com/api/$2" ;;
241-
"staging") echo "https://workbench-staging.verily.com/api/$2" ;;
242241
"prod") echo "https://workbench.verily.com/api/$2" ;;
243242
*) return 1 ;;
244243
esac

0 commit comments

Comments
 (0)