Created
December 18, 2023 16:13
-
-
Save Intelrunner/b547ba29fc25e43c1ade7545674b34ea to your computer and use it in GitHub Desktop.
Cloudbuild.yaml for Golang to pull from Artifact Registry (module) and build to CloudFunctions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- name: golang | |
entrypoint: go | |
args: [ 'run', 'github.com/GoogleCloudPlatform/artifact-registry-go-tools/cmd/[email protected]', 'add-locations', '--locations=${_LOCATION}' ] | |
env: | |
# Set GOPROXY to the public proxy to pull the credential helper tool | |
- 'GOPROXY=proxy.golang.org' | |
- name: golang | |
entrypoint: go | |
args: [ 'run', 'github.com/GoogleCloudPlatform/artifact-registry-go-tools/cmd/[email protected]', 'refresh' ] | |
env: | |
- 'GOPROXY=proxy.golang.org' | |
- 'GONOPROXY=github.com/GoogleCloudPlatform/artifact-registry-go-tools' | |
# Add Vendor folder | |
- name: golang | |
entrypoint: go | |
args: [ 'mod', 'tidy' ] | |
env: | |
- 'GONOPROXY=github.com/GoogleCloudPlatform/artifact-registry-go-tools' | |
- 'GONOSUMDB=*.${_MODULE_PATH}' | |
- 'GOPRIVATE=*.${_MODULE_PATH}' | |
- name: golang | |
entrypoint: go | |
args: [ 'mod', 'vendor' ] | |
env: | |
- 'GONOPROXY=github.com/GoogleCloudPlatform/artifact-registry-go-tools' | |
- 'GONOSUMDB=*.${_MODULE_PATH}' | |
- 'GOPRIVATE=*.${_MODULE_PATH}' | |
- name: gcr.io/google.com/cloudsdktool/cloud-sdk | |
args: | |
- gcloud | |
- functions | |
- deploy | |
- hello-go | |
- --allow-unauthenticated | |
- --region=us-central1 | |
- --source=. | |
- --trigger-http | |
- --runtime=go121 | |
- --entry-point=HelloHTTP | |
- --set-build-env-vars=^;^GONOSUMDB="${_MODULE_PATH}";GOPRIVATE="${_MODULE_PATH}";GONOPROXY="github.com/GoogleCloudPlatform/artifact-registry-go-tools";GOPROXY="${_LOCATION}-go.pkg.dev/${_PROJECT_ID}/${_REPOSITORY},https://proxy.golang.org,direct" | |
options: | |
env: # Disable GO sumdb checks for private modules. | |
- 'GONOPROXY=github.com/GoogleCloudPlatform/artifact-registry-go-tools' | |
- 'GOPROXY=${_LOCATION}-go.pkg.dev/${_PROJECT_ID}/${_REPOSITORY},https://proxy.golang.org,direct' | |
- 'GONOSUMDB=${_MODULE_PATH}' | |
- 'GOPRIVATE=${_MODULE_PATH}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment