-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a build trigger that updates CDC stable images
- Loading branch information
Showing
3 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# 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. | ||
|
||
# Updates stable-tagged Docker images for custom DC. | ||
# Assumes the stable branch is already checked out, which it should be | ||
# if this is triggered on push to branch for the stable branch. | ||
|
||
steps: | ||
# Step 0: Initialize submods | ||
- id: init-submods | ||
name: gcr.io/cloud-builders/git | ||
args: | ||
- submodule update --init --recursive | ||
waitFor: ["-"] | ||
|
||
# Step 1: Get a label that combines commit hashes. | ||
- id: get-label | ||
name: gcr.io/cloud-builders/git | ||
entrypoint: bash | ||
args: | ||
- -c | ||
- | | ||
set -e | ||
./scripts/get_commits_label.sh | tail -1 >"$_IMAGE_LABEL_PATH" | ||
waitFor: ["init-submods"] | ||
|
||
# Step 1: Services container | ||
- id: build-and-tag-stable-services | ||
name: gcr.io/datcom-ci/deploy-tool | ||
entrypoint: bash | ||
args: | ||
- -c | ||
- | | ||
set -e | ||
image_label=$(cat "$_IMAGE_LABEL_PATH") | ||
./scripts/build_cdc_services_and_tag_stable.sh $image_label | ||
waitFor: ["get-label"] | ||
|
||
# Step 2: Data management container | ||
- id: build-and-tag-stable-data | ||
name: gcr.io/datcom-ci/deploy-tool | ||
entrypoint: bash | ||
args: | ||
- -c | ||
- | | ||
set -e | ||
image_label=$(cat "$_IMAGE_LABEL_PATH") | ||
./scripts/build_cdc_data_and_tag_stable.sh $image_label | ||
waitFor: ["get-label"] | ||
|
||
substitutions: | ||
_IMAGE_LABEL_PATH: "/workspace/tmp_cdc_stable_image_label.txt" | ||
|
||
options: | ||
machineType: "E2_HIGHCPU_32" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# 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. | ||
|
||
# Make a label for container images using the combined commit hash of website | ||
# and its submods. | ||
|
||
# Optionally use the commit before HEAD for the main repo. | ||
if [[ "$1" == "--head-is-temporary" ]]; then | ||
website_rev="$(git rev-parse --short HEAD~1)" | ||
else | ||
website_rev="$(git rev-parse --short HEAD)" | ||
fi | ||
mixer_rev="$(git rev-parse --short HEAD:mixer)" | ||
import_rev="$(git rev-parse --short HEAD:import)" | ||
image_label="${website_rev}-${mixer_rev}-${import_rev}" | ||
|
||
echo "$image_label" |
This file contains 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