Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace container registery with artifact registry in CloudBuild #367

Conversation

renato-rudnicki
Copy link
Contributor

@renato-rudnicki renato-rudnicki commented Mar 5, 2021

Fixes #366

This PR replaces gcr.io/$PROJECT_ID/terraform with $_DEFAULT_REGION-docker.pkg.dev/$PROJECT_ID/prj-tf-runners/terraform in the CloudBuild files.

Result with the fix:

Starting Step #0 - "setup"
Step #0 - "setup": Pulling image: us-east1-docker.pkg.dev/prj-cloudbuild-34b9/prj-tf-runners/terraform
Step #0 - "setup": Using default tag: latest
Step #0 - "setup": latest: Pulling from prj-cloudbuild-34b9/prj-tf-runners/terraform
Step #0 - "setup": 75f546e73d8b: Already exists

Copy link
Member

@bharathkkb bharathkkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix @renato-rudnicki
Lets switch to using_GAR_REPOSITORY terraform-google-modules/terraform-google-bootstrap#97 from 2.2.1 release

@daniel-cit
Copy link
Contributor

Using version v2.2.1 of the terraform-google-bootstrap module to create the infra structure, the value set for the environment variable _GAR_REPOSITORY in the cloud build triggers is prj-tf-runners.

Would the final form of the fix be something like this?

name: $_DEFAULT_REGION-docker.pkg.dev/$PROJECT_ID/$_GAR_REPOSITORY/terraform

@bharathkkb

@bharathkkb
Copy link
Member

@daniel-cit yeah that looks right. Users of example-foundation can also pass a custom repo via gar_repo_name and by using $_GAR_REPOSITORY we can get that in CB.

@daniel-cit
Copy link
Contributor

With the last commit the docker build steps in the build yaml files are now using the _GAR_REPOSITORY variable:

steps:
- id: 'setup'
  name: $_DEFAULT_REGION-docker.pkg.dev/$PROJECT_ID/$_GAR_REPOSITORY/terraform
  entrypoint: /bin/bash
  args:

The result with the new version:

Starting Step #0 - "setup"
Step #0 - "setup": Pulling image: us-east1-docker.pkg.dev/prj-cloudbuild-9473/prj-tf-runners/terraform
Step #0 - "setup": Using default tag: latest
Step #0 - "setup": latest: Pulling from prj-cloudbuild-9473/prj-tf-runners/terraform

Copy link
Member

@bharathkkb bharathkkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one question

entrypoint: /bin/bash
args:
- -c
- |
- |''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
This line should not have been changed. We will revert this it.

@renato-rudnicki renato-rudnicki force-pushed the use-artifact-register-in-cloudbuild branch from 9da305b to eb7dc2a Compare March 10, 2021 13:02
@bharathkkb bharathkkb merged commit f0149f8 into terraform-google-modules:develop Mar 10, 2021
bharathkkb pushed a commit that referenced this pull request Mar 30, 2021
…#367)

* Replace container registery with artifact registry in CloudBuild

* Adding

* Fixing cloudbuild-tf-appl.yaml
bharathkkb pushed a commit that referenced this pull request Mar 30, 2021
…#367)

* Replace container registery with artifact registry in CloudBuild

* Adding

* Fixing cloudbuild-tf-appl.yaml
bharathkkb pushed a commit that referenced this pull request Mar 30, 2021
…#367)

* Replace container registery with artifact registry in CloudBuild

* Adding

* Fixing cloudbuild-tf-appl.yaml
bharathkkb pushed a commit that referenced this pull request Mar 31, 2021
…#367)

* Replace container registery with artifact registry in CloudBuild

* Adding

* Fixing cloudbuild-tf-appl.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants