Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into tflint_provider
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Nov 12, 2023
2 parents e70e863 + aa8bead commit 7ea6b9f
Show file tree
Hide file tree
Showing 1,532 changed files with 66,343 additions and 16,109 deletions.
8 changes: 7 additions & 1 deletion .ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,20 @@ done

In the event of a failure, this will stop running. If it succeeds, update the sync tag with `git push origin HEAD:tpg-sync`.

### Downstream build job is not triggered by commits.
This is rare but we've seen this happened before. In this case, we need to manually trigger a Cloud Build job by running
```
gcloud builds triggers run build-downstreams --project=graphite-docker-images --substitutions=BRANCH_NAME=<BASE_BRANCH_NAME> --sha=<COMMIT_SHA>
```
You'll need to substitute `<COMMIT_SHA>` with the commit sha that you'd like to trigger the build against and `<BASE_BRANCH_NAME>` with base branch that this commit is pushed into, likely `main` but could be feature branches in some cases.

## Deploying the pipeline
The code on the PR's branch is used to plan actions - no merge is performed.
If you are making changes to the workflows, your changes will not trigger a workflow run, because of the risk of an untrusted contributor introducing malicious code in this way. You will need to test locally by using the [cloud build local builder](https://cloud.google.com/cloud-build/docs/build-debug-locally).
If you are making changes to the containers, your changes will not apply until they are merged in and built - this can take up to 15 minutes. If you need to make a breaking change, you will need to pause the pipeline while the build happens. If you are making changes to both the containers and the workflows and those changes need to be coordinated, you will need to pause the build while the containers build and enforce every open PR be rebased on top of our PR. It is probably better to build in backwards-compatibility into your containers. We recommend a 14 day window - 14 days after your change goes in, you can remove the backwards-compatibility.

Pausing the pipeline is done in the cloud console, by setting the downstream-builder trigger to disabled. You can find that trigger [here](https://console.cloud.google.com/cloud-build/triggers/edit/f80a7496-b2f4-4980-a706-c5425a52045b?project=graphite-docker-images)


## Dependency change handbook:
If someone (often a bot) creates a PR which updates Gemfile or Gemfile.lock, they will not be able to generate diffs. This is because bundler doesn't allow you to run a binary unless your installed gems exactly match the Gemfile.lock, and since we have to run generation before and after the change, there is no possible container that will satisfy all requirements.

Expand Down
22 changes: 21 additions & 1 deletion .ci/containers/go-plus/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
from golang:1.19-bullseye as resource
# Stage 1: Download go module cache for builds
FROM golang:1.19-bullseye AS builder
ENV GOCACHE=/go/cache

RUN apt-get update && apt-get install -y unzip
WORKDIR /app1
# Add the source code and build
ADD "https://github.com/GoogleCloudPlatform/magic-modules/archive/refs/heads/main.zip" source.zip
RUN unzip source.zip && rm source.zip
WORKDIR /app1/magic-modules-main/.ci/magician
# Build the binary (we won't use it in the final image, but it's cached)
RUN go build -o /dev/null .

# Stage 2: Creating the final image
FROM golang:1.19-bullseye
SHELL ["/bin/bash", "-c"]
ENV GOCACHE=/go/cache

# Copy Go dependencies and Go build cache
COPY --from=builder /go/pkg/mod /go/pkg/mod
COPY --from=builder /go/cache /go/cache

# Set up Github SSH cloning.
RUN ssh-keyscan github.com >> /known_hosts
RUN echo "UserKnownHostsFile /known_hosts" >> /etc/ssh/ssh_config
Expand Down
8 changes: 0 additions & 8 deletions .ci/containers/membership-checker/Dockerfile

This file was deleted.

152 changes: 0 additions & 152 deletions .ci/containers/membership-checker/community.go

This file was deleted.

131 changes: 0 additions & 131 deletions .ci/containers/membership-checker/main.go

This file was deleted.

Loading

0 comments on commit 7ea6b9f

Please sign in to comment.