add post checkout to pull main
that enables correct diff of PR with ...main
This commit is contained in:
parent
c923185aee
commit
cfef78c89f
6 changed files with 43 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
# Overview
|
# Overview
|
||||||
This folder contains files related to the machines running the build/test/checks for the merge guards.
|
This folder contains files related to the machines running the build/test/checks
|
||||||
|
for the merge guards.
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
The scripts are written in bash (for Linux) and powershell (for Windows).
|
The scripts are written in bash (for Linux) and powershell (for Windows).
|
||||||
|
@ -8,4 +9,12 @@ The scripts are written in bash (for Linux) and powershell (for Windows).
|
||||||
Build the docker image and run it locally. This is useful for testing it.
|
Build the docker image and run it locally. This is useful for testing it.
|
||||||
|
|
||||||
### build_deploy.(sh|ps1)
|
### build_deploy.(sh|ps1)
|
||||||
Build the docker and deploy it to the GCP registry. This is useful for deploying it in the Kubernetes cluster.
|
Build the docker and deploy it to the GCP registry. This is useful for deploying
|
||||||
|
it in the Kubernetes cluster.
|
||||||
|
|
||||||
|
`buildkite-linux` has a cloudbuild.yaml and can be build / deployed by running
|
||||||
|
`gcloud builds submit --config ./cloudbuild.yaml`.
|
||||||
|
|
||||||
|
Note that some of the images are stored at
|
||||||
|
us-central1-docker.pkg.dev/llvm-premerge-checks/docker/ and some at
|
||||||
|
gcr.io/llvm-premerge-checks/ . Prefer a former one if possible.
|
|
@ -6,11 +6,11 @@
|
||||||
steps:
|
steps:
|
||||||
- name: 'gcr.io/${PROJECT_ID}/windows-builder'
|
- name: 'gcr.io/${PROJECT_ID}/windows-builder'
|
||||||
args: ['--image','windows-cloud/global/images/windows-server-2019-dc-core-for-containers-v20230113',
|
args: ['--image','windows-cloud/global/images/windows-server-2019-dc-core-for-containers-v20230113',
|
||||||
'--network', 'vpc-network',
|
#'--network', 'vpc-network',
|
||||||
'--subnetwork', 'subnetwork',
|
#'--subnetwork', 'subnetwork',
|
||||||
'--region', 'europe-west3',
|
#'--region', 'europe-west3',
|
||||||
'--zone', 'europe-west3-c',
|
#'--zone', 'europe-west3-c',
|
||||||
'--machineType', "n2-standard-16",
|
'--machineType', "n2-standard-16",
|
||||||
'--diskType', 'pd-ssd',
|
#'--diskType', 'pd-ssd',
|
||||||
'--command', 'gcloud auth configure-docker --quiet && docker build -t gcr.io/${PROJECT_ID}/buildkite-premerge-windows:latest . && docker push gcr.io/${PROJECT_ID}/buildkite-premerge-windows:latest']
|
'--command', 'gcloud auth configure-docker --quiet && docker build -t gcr.io/${PROJECT_ID}/buildkite-premerge-windows:latest . && docker push us-central1-docker.pkg.dev/llvm-premerge-checks/docker/buildkite-windows:latest']
|
||||||
timeout: 7200s
|
timeout: 7200s
|
|
@ -83,6 +83,7 @@ RUN echo 'install buildkite' ;\
|
||||||
apt-get clean;
|
apt-get clean;
|
||||||
|
|
||||||
COPY --chown=buildkite-agent:buildkite-agent pre-checkout /etc/buildkite-agent/hooks
|
COPY --chown=buildkite-agent:buildkite-agent pre-checkout /etc/buildkite-agent/hooks
|
||||||
|
COPY --chown=buildkite-agent:buildkite-agent post-checkout /etc/buildkite-agent/hooks
|
||||||
|
|
||||||
# buildkite working directory
|
# buildkite working directory
|
||||||
VOLUME /var/lib/buildkite-agent
|
VOLUME /var/lib/buildkite-agent
|
||||||
|
|
23
containers/buildkite-linux/post-checkout
Executable file
23
containers/buildkite-linux/post-checkout
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2023 Google LLC
|
||||||
|
#
|
||||||
|
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://llvm.org/LICENSE.txt
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# See https://buildkite.com/docs/agent/v3/hooks#job-lifecycle-hooks
|
||||||
|
# The `post-checkout` hook runs after checkout.
|
||||||
|
|
||||||
|
# Pull changes from origin/main so that diff origin/main...HEAD will show a
|
||||||
|
# correct diff of Pull Requests that have multiple commits.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
git fetch origin main:main
|
|
@ -34,7 +34,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: runner
|
- name: runner
|
||||||
image: gcr.io/llvm-premerge-checks/buildkite-linux:latest
|
image: us-central1-docker.pkg.dev/llvm-premerge-checks/docker/buildkite-linux:latest
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 2
|
cpu: 2
|
||||||
|
|
|
@ -34,7 +34,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: buildkite-premerge-debian
|
- name: buildkite-premerge-debian
|
||||||
image: gcr.io/llvm-premerge-checks/buildkite-linux:latest
|
image: us-central1-docker.pkg.dev/llvm-premerge-checks/docker/buildkite-linux:latest
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 2
|
cpu: 2
|
||||||
|
|
Loading…
Reference in a new issue