Skip to content

Commit

Permalink
Use GITHUB_TOKEN in curl requests, run generate-go-mod.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cnunciato committed Jan 12, 2023
1 parent 28a67a4 commit b946565
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion aws-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-aws/sdk/v5 v5.25.0
github.com/pulumi/pulumi-aws/sdk/v5 v5.27.0
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)
2 changes: 1 addition & 1 deletion azure-classic-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-azure/sdk/v5 v5.28.0
github.com/pulumi/pulumi-azure/sdk/v5 v5.30.0
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)
2 changes: 1 addition & 1 deletion azure-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-azure-native/sdk v1.90.0
github.com/pulumi/pulumi-azure-native/sdk v1.91.0
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)
2 changes: 1 addition & 1 deletion civo-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-civo/sdk/v2 v2.3.0
github.com/pulumi/pulumi-civo/sdk/v2 v2.3.1
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)

2 changes: 1 addition & 1 deletion equinix-metal-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-equinix-metal/sdk/v2 v3.2.1
github.com/pulumi/pulumi-equinix-metal/sdk/v3 v3.2.1
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)
2 changes: 1 addition & 1 deletion equinix-metal-go/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
metal "github.com/pulumi/pulumi-equinix-metal/sdk/v2/go/equinix"
metal "github.com/pulumi/pulumi-equinix-metal/sdk/v3/go/equinix"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

Expand Down
2 changes: 1 addition & 1 deletion gcp-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-gcp/sdk/v6 v6.45.0
github.com/pulumi/pulumi-gcp/sdk/v6 v6.46.0
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)
14 changes: 11 additions & 3 deletions generator/generate-go-mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ set -o nounset
set -o errexit
set -o pipefail

PULUMI_VERSION="$(curl -s https://api.github.com/repos/pulumi/pulumi/releases/latest | jq -r .name)"
# Fetch the latest release version of the given Pulumi repo.
fetch_latest_version() {
local repo="pulumi/$1"
curl -s \
-H "Authorization: token ${GITHUB_TOKEN}" \
"https://api.github.com/repos/${repo}/releases/latest" | jq -r .name
}

PROVIDER_LIST="alicloud,aws,azure-classic,azure,digitalocean,equinix-metal,gcp,google-native,kubernetes,linode,openstack,civo,aiven,auth0,github,oci"
PULUMI_VERSION="$(fetch_latest_version pulumi)"

PROVIDER_LIST="alicloud,aws,azure-classic,azure,digitalocean,equinix-metal,gcp,google-native,kubernetes,linode,openstack,civo,aiven,auth0,oci"
IFS=',' read -ra PROVIDERS <<< "$PROVIDER_LIST"

for i in "${PROVIDERS[@]}"
Expand All @@ -19,7 +27,7 @@ do
else
PROVIDER_NAME="$i"
fi
PROVIDER_VERSION="$(curl -s https://api.github.com/repos/pulumi/pulumi-$PROVIDER_NAME/releases/latest | jq -r .name)"
PROVIDER_VERSION="$(fetch_latest_version "pulumi-$PROVIDER_NAME")"
sed -e "s/\${VERSION}/$PROVIDER_VERSION/g" -e "s/\${PULUMI_VERSION}/$PULUMI_VERSION/g" mod-templates/$i-template.txt | tee ../$i-go/go.mod
echo "Updated $i go mod template to be Pulumi $PULUMI_VERSION and pulumi-$i to be" $PROVIDER_VERSION
done
Expand Down
2 changes: 1 addition & 1 deletion generator/mod-templates/equinix-metal-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-equinix-metal/sdk/v2 ${VERSION}
github.com/pulumi/pulumi-equinix-metal/sdk/v3 ${VERSION}
github.com/pulumi/pulumi/sdk/v3 ${PULUMI_VERSION}
)
1 change: 0 additions & 1 deletion generator/mod-templates/github-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ require (
github.com/pulumi/pulumi-github/sdk/v4 ${VERSION}
github.com/pulumi/pulumi/sdk/v3 ${PULUMI_VERSION}
)

3 changes: 1 addition & 2 deletions github-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module ${PROJECT}
go 1.17

require (
github.com/pulumi/pulumi-github/sdk/v4 v5.1.0
github.com/pulumi/pulumi-github/sdk/v4 v4.17.0
github.com/pulumi/pulumi/sdk/v3 v3.51.0
)

0 comments on commit b946565

Please sign in to comment.