-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and publish charts for OBS/IBS artifacts in gh-pages
Signed-off-by: David Cassany <dcassany@suse.com>
- Loading branch information
1 parent
c90c1c8
commit d300159
Showing
11 changed files
with
163 additions
and
211 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 @@ | ||
name: Build and publish charts | ||
|
||
inputs: | ||
build_env: | ||
required: true | ||
keep_previous: | ||
required: false | ||
default: no | ||
ibs_release: | ||
required: false | ||
default: no | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install yq | ||
uses: mikefarah/yq@v4.28.2 | ||
- name: Set image repositories | ||
id: set_repo | ||
shell: bash | ||
env: | ||
B_ENV: ${{ inputs.build_env }} | ||
IBS_RELEASE: ${{ inputs.ibs_release }} | ||
run: | | ||
if [ "${IBS_RELEASE}" == "yes" ]; then | ||
echo "B_REPO=registry.suse.com" >> $GITHUB_OUTPUT | ||
else | ||
echo "B_REPO=registry.opensuse.org/isv/rancher/elemental/${B_ENV}/containers" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Build chart for release | ||
env: | ||
B_REPO: ${{ steps.set_repo.outputs.B_REPO }} | ||
OPERATOR_REPO: rancher/elemental-operator | ||
SEEDIMAGE_REPO: rancher/seedimage-builder | ||
CHANNEL_REPO: rancher/elemental-teal-channel | ||
shell: bash | ||
run: | | ||
REGISTRY_URL=${B_REPO} \ | ||
REPO=${OPERATOR_REPO} \ | ||
REPO_SEEDIMAGE=${SEEDIMAGE_REPO} \ | ||
REPO_CHANNEL=${CHANNEL_REPO} \ | ||
make chart | ||
- name: Build and push index | ||
env: | ||
B_ENV: ${{ inputs.build_env }} | ||
KEEP_PREV: ${{ inputs.keep_previous }} | ||
IBS_RELEASE: ${{ inputs.ibs_release }} | ||
shell: bash | ||
run: | | ||
COMMIT=$(git rev-parse HEAD) | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
git config --global user.name "${{ github.actor }}" | ||
git checkout gh-pages | ||
if [ "${IBS_RELEASE}" == "yes" ]; then | ||
B_ENV="release" | ||
fi | ||
if [ "${KEEP_PREV}" == "no" ]; then | ||
rm -rf ${B_ENV} | ||
fi | ||
mkdir -p ${B_ENV}/build | ||
cp -v build/* ${B_ENV}/build | ||
helm repo index --url https://rancher.github.io/elemental-operator ./${B_ENV} | ||
git add ${B_ENV}/index.yaml ${B_ENV}/build/ -f | ||
git commit -m "Updating helm dev repo to main commit ${{ github.sha }}" | ||
git push --set-upstream origin gh-pages | ||
git checkout ${COMMIT} |
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 |
---|---|---|
@@ -1,90 +1,20 @@ | ||
name: Build and publish chart | ||
name: Build and publish development charts | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
|
||
jobs: | ||
chart: | ||
dev-charts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install yq | ||
uses: mikefarah/yq@v4.28.2 | ||
- name: Build chart for CI | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
make chart | ||
- name: Build chart for release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
REGISTRY_URL=quay.io/costoolkit REPO=elemental-operator REPO_SEEDIMAGE=elemental-seedimage TAG=${GITHUB_REF##*/} make chart | ||
- name: Publish chart to release | ||
uses: fnkr/github-action-ghr@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
GHR_COMPRESS: tgz | ||
GHR_PATH: build/ | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GHR_REPLACE: true | ||
- name: Install Helm | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: azure/setup-helm@v1 | ||
- name: Build and publish OBS dev charts | ||
uses: "./.github/actions/chart" | ||
with: | ||
version: v3.7.1 | ||
- name: Set chart output | ||
id: chart | ||
run: | | ||
CHART=$(find . -type f -name "elemental-operator-[1-9]*.tgz" -print) | ||
echo "chart_name=$CHART" >> $GITHUB_OUTPUT | ||
- name: Test chart values | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
REGISTRY_URL=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .registry_url) | ||
REPO=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.repository) | ||
if [ "$REGISTRY_URL" != "quay.io/coostoolkit" ]; then | ||
echo "registry_url on the built chart is not the expected value" | ||
echo "Expected quay.io/coostoolkit but got $REGISTRY_URL" | ||
fi | ||
if [ "$REPO" != "elemental-operator-ci" ];then | ||
echo "REPO on the built chart is not the expected value" | ||
echo "Expected elemental-operator-ci but got $REPO" | ||
exit 1 | ||
fi | ||
- name: Test release chart values | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
REGISTRY_URL=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .registry_url)) | ||
REPO=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.repository) | ||
TAG=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.tag) | ||
if [ "$REGISTRY_URL" != "quay.io/coostoolkit" ]; then | ||
echo "registry_url on the built chart is not the expected value" | ||
echo "Expected quay.io/coostoolkit but got $REGISTRY_URL" | ||
fi | ||
if [ "$REPO" != "elemental-operator" ];then | ||
echo "REPO on the built chart is not the expected value" | ||
echo "Expected elemental-operator but got $REPO" | ||
exit 1 | ||
fi | ||
if [ "$TAG" != "${GITHUB_REF##*/}" ];then | ||
echo "TAG on the built chart is not the expected value" | ||
echo "Expected ${GITHUB_REF##*/} but got $TAG" | ||
exit 1 | ||
fi | ||
- name: Build and push index | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
git config --global user.name "${{ github.actor }}" | ||
git checkout gh-pages | ||
rm index.yaml | ||
helm repo index --url https://rancher.github.io/elemental-operator . | ||
git add index.yaml build/ -f | ||
git commit -m "Updating helm repo to main commit ${{ github.sha }}" | ||
git push --set-upstream origin gh-pages | ||
build_env: dev |
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
name: Build and publish staging or stable charts | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Tag to build" | ||
required: true | ||
type: string | ||
release: | ||
description: "Release stable versions, staging otherwise" | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
stable-charts: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Log inputs | ||
run: echo "${{ toJSON(github.event.inputs) }}" | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ inputs.tag }} | ||
- name: Build and publish OBS staging charts | ||
if: inputs.release == false | ||
uses: "./.github/actions/chart" | ||
with: | ||
build_env: staging | ||
- name: Build and publish OBS stable charts | ||
if: inputs.release == true | ||
uses: "./.github/actions/chart" | ||
with: | ||
build_env: stable | ||
keep_previous: yes | ||
- name: Clear built artifacts | ||
if: inputs.release == true | ||
shell: bash | ||
run: | | ||
rm -rf build/* | ||
- name: Build and publish IBS charts | ||
if: inputs.release == true | ||
uses: "./.github/actions/chart" | ||
with: | ||
build_env: stable | ||
keep_previous: yes | ||
ibs_release: yes | ||
- name: create release | ||
if: inputs.release == true | ||
uses: ncipollo/release-action@v1 | ||
id: create_release | ||
with: | ||
tag: ${{ inputs.tag }} | ||
draft: false | ||
prerelease: true | ||
generateReleaseNotes: true | ||
artifacts: "build/*" | ||
updateOnlyUnreleased: true | ||
allowUpdates: true |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.