-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to automate config connector release bundle creation
- Loading branch information
Showing
6 changed files
with
144 additions
and
25 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,35 @@ | ||
# Copyright 2025 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 | ||
# | ||
# http://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. | ||
|
||
name: Config Connector Release Automation | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
create-and-push-release-bundle: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v1 | ||
|
||
- name: Run the create-relese-bundle script | ||
run: | | ||
chmod +x ./scripts/github-actions/create-release-bundle.sh | ||
./scripts/github-actions/create-release-bundle.sh |
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
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
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
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,72 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2022 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 | ||
# | ||
# http://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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# runs the config-connector build across all desired systems and architectures and creates a release tarball | ||
REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
cd ${REPO_ROOT} | ||
|
||
|
||
BUILD_DIR="${REPO_ROOT}/.build" | ||
mkdir -p "${BUILD_DIR}" | ||
|
||
|
||
MANUAL_DIR="${BUILD_DIR}/manual-release" | ||
mkdir -p "${MANUAL_DIR}/operator-system" | ||
|
||
# Find the version of the operator image | ||
FOLDER_PATH="${REPO_ROOT}/operator/channels/packages/configconnector" | ||
|
||
if [ ! -d "$FOLDER_PATH" ]; then | ||
echo "Error: Directory $FOLDER_PATH does not exist" | ||
exit 1 | ||
fi | ||
|
||
# List all directories in the specified path and store them in an array | ||
VERSIONS=($(ls -d "$FOLDER_PATH"/*/ 2>/dev/null | xargs -n 1 basename | sort -V)) | ||
|
||
if [ ${#VERSIONS[@]} -eq 0 ]; then | ||
echo "Error: No version directories found in $FOLDER_PATH" | ||
exit 1 | ||
fi | ||
|
||
LATEST_VERSION="${VERSIONS[-1]}" | ||
OPERATOR_IMG=gcr.io/gke-release/cnrm/operator:${LATEST_VERSION} | ||
|
||
echo "Updating kustomize image patch file for manager." | ||
cp ${REPO_ROOT}/operator/config/manager/manager_image_patch_template.yaml ${REPO_ROOT}/operator/config/manager/manager_image_patch.yaml | ||
sed -i'' -e 's@image: .*@image: '"${OPERATOR_IMG}"'@' ${REPO_ROOT}/operator/config/manager/manager_image_patch.yaml | ||
cp -f ${REPO_ROOT}/operator/config/autopilot-manager/manager_image_patch_template.yaml ${REPO_ROOT}/operator/config/autopilot-manager/manager_image_patch.yaml | ||
sed -i'' -e 's@image: .*@image: '"${OPERATOR_IMG}"'@' ${REPO_ROOT}/operator/config/autopilot-manager/manager_image_patch.yaml | ||
|
||
kustomize build ${REPO_ROOT}/config/installbundle/release-manifests/standard -o ${MANUAL_DIR}/operator-system/configconnector-operator.yaml | ||
echo "Added standard release manifest to ${MANUAL_DIR}/operator-system/configconnector-operator.yaml" | ||
|
||
kustomize build ${REPO_ROOT}/config/installbundle/release-manifests/autopilot -o ${MANUAL_DIR}/operator-system/autopilot-configconnector-operator.yaml | ||
echo "Added autopilot release manifest to ${MANUAL_DIR}/operator-system/autopilot-configconnector-operator.yaml" | ||
|
||
cp -rf operator/config/samples ${MANUAL_DIR}/ | ||
|
||
tar -czvf ${BUILD_DIR}/release-bundle.tar.gz -C ${MANUAL_DIR}/ . | ||
|
||
echo "Generated ${BUILD_DIR}/release-bundle.tar.gz for manual installation." | ||
|
||
gsutil cp ${REPO_ROOT}/.build/release-bundle.tar.gz gs://configconnector-operator/${LATEST_VERSION}/ | ||
gsutil cp ${REPO_ROOT}/.build/release-bundle.tar.gz gs://configconnector-operator/latest | ||
|
||
echo "Pushed the latest release-bundle." |
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,26 @@ | ||
#!/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 | ||
# | ||
# http://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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
echo "Start creating the release bundle" | ||
|
||
REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
|
||
# build release manifest | ||
source ${REPO_ROOT}/dev/tasks/deploy-release-manifest | ||
|