GoogleCloudPlatform / pubsec-declarative-toolkit

The GCP PubSec Declarative Toolkit is a collection of declarative solutions to help you on your Journey to Google Cloud. Solutions are designed using Config Connector and deployed using Config Controller.
Apache License 2.0
31 stars 28 forks source link

Fix LZ V2 readme KPT instructions - URL variable per package - missing from core-landing-zone kpt package pull instructions - causing script error #540

Open obriensystems opened 1 year ago

obriensystems commented 1 year ago

see section 2 https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/tree/main/docs/landing-zone-v2#folder-structure-per-environment-dev-preprod-prod history https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/commit/d6694fb3428eb3c9799476bf4d35b2bc0517e5cd

michael@cloudshell:~/kcc-oi/kpt (kcc-oi)$ PACKAGE="solutions/gatekeeper-policies"
michael@cloudshell:~/kcc-oi/kpt (kcc-oi)$ VERSION=$(curl -s $URL | jq -r ".\"$PACKAGE\"")
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

add all 4 specific URLs per package

michael@cloudshell:~/kcc-oi/kpt (kcc-oi)$ URL=https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/releases?q=gatekeeper&expanded=true

michael@cloudshell:~/kcc-oi/kpt (kcc-oi)$ curl -s $URL | jq -r ".\"$PACKAGE\""
parse error: Invalid numeric literal at line 8, column 10

or workaround - just get main for now

michael@cloudshell:~/kcc-oi/kpt (kcc-oi)$ VERSION=main
michael@cloudshell:~/kcc-oi/kpt (kcc-oi)$ kpt pkg get https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit.git/${PACKAGE}@${VERSION}
Package "gatekeeper-policies":
Fetching https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit@main
From https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
Adding package "solutions/gatekeeper-policies".

Fetched 1 package(s).

adjustment

add URL
URL="https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/releases?q=gatekeeper&expanded=true"
michael@cloudshell:~ (duet-ai-old)$ VERSION=$(curl -s $URL | jq -r ".\"$PACKAGE\"")
parse error: Invalid numeric literal at line 8, column 10

we are looking for the following format in html - getting json

  <h2 class="sr-only" id="hd-079dc150">solutions/gatekeeper-policies: v0.2.0</h2>

json URL="https://api.github.com/repos/GoogleCloudPlatform/pubsec-declarative-toolkit/releases"

fmichaelobrien commented 1 year ago

Use the main release for all kpt packages until we fix the URL and the json parsing around URL="https://api.github.com/repos/GoogleCloudPlatform/pubsec-declarative-toolkit/releases" see PR https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/pull/543

From Chris URL="https://raw.githubusercontent.com/GoogleCloudPlatform/pubsec-declarative-toolkit/main/.release-please-manifest.json"

fmichaelobrien commented 1 year ago

All SH fragments in readme docs are tested either in isolation or as part of a full setup script

michael@cloudshell:~/_t$ URL="https://raw.githubusercontent.com/GoogleCloudPlatform/pubsec-declarative-toolkit/main/.release-please-manifest.json"
michael@cloudshell:~/_t$ PACKAGE="solutions/client-setup"
michael@cloudshell:~/_t$ VERSION=$(curl -s $URL | jq -r ".\"$PACKAGE\"")
michael@cloudshell:~/_t$ echo $VERSION
0.6.1