Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/charts-values-update-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---

# Charts release configuration file example
# This file is used to update the version of the helm charts and images in the values.yaml file
# It is used in the helm-charts-release action
# ${release} is replaced with the release version provided in the workflow

charts:
- name: patroni-core
chart_file: charts/patroni-core/Chart.yaml
values_file: charts/patroni-core/values.yaml
image:
- ghcr.io/netcracker/qubership-credential-manager:#latest
- ghcr.io/netcracker/pgskipper-operator:${release}
- ghcr.io/netcracker/pgskipper-patroni-16:#latest
- ghcr.io/netcracker/pgskipper-upgrade:#^release-.+
- ghcr.io/netcracker/pgskipper-operator-tests:${release}
- name: patroni-services
chart_file: charts/patroni-services/Chart.yaml
values_file: charts/patroni-services/values.yaml
image:
- ghcr.io/netcracker/qubership-credential-manager:#latest
- ghcr.io/netcracker/pgskipper-operator:${release}
- ghcr.io/netcracker/pgskipper-monitoring-agent:#^release-.+
- ghcr.io/netcracker/pgskipper-backup-daemon:#^release-.+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until it merged to monorepo we need to use #latest or placeholders like ${backup_daemon_version}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fell free to edit configuration according to your needs

- ghcr.io/netcracker/pgskipper-dbaas-adapter:#^release-.+
- ghcr.io/netcracker/qubership-query-exporter:#^release-.+
- ghcr.io/netcracker/pgskipper-replication-controller:#^release-.+
- ghcr.io/netcracker/pgskipper-operator-tests:${release}
20 changes: 20 additions & 0 deletions .github/docker-build-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"components": [
{
"name": "pgskipper-operator",
"file": "build/Dockerfile",
"context": "."
},
{
"name": "pgskipper-operator-tests",
"file": "tests/Dockerfile",
"context": "tests"
},
{
"name": "pgskipper-operator-transfer",
"file": "./docker-transfer/Dockerfile",
"context": "."
}
],
"platforms": "linux/amd64,linux/arm64"
}
183 changes: 183 additions & 0 deletions .github/workflows/helm-charts-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
---

name: Helm Charts Release
on:
workflow_dispatch:
inputs:
release:
description: 'Release version'
required: true
type: string
permissions:
contents: write
packages: write
run-name: ${{ github.repository }} Release ${{ github.event.inputs.release }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-tag:
runs-on: ubuntu-latest
steps:
- name: Check if tag exists
id: check_tag
uses: netcracker/qubership-workflow-hub/actions/[email protected]
with:
tag-name: '${{ inputs.release }}'
ref: ${{ github.ref }}
create-tag: false
check-tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
load-docker-build-components:
runs-on: ubuntu-latest
outputs:
component: ${{ steps.load_component.outputs.components }}
platforms: ${{ steps.load_component.outputs.platforms }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Load Docker Configuration
id: load_component
run: |
verify=$(cat "$GITHUB_WORKSPACE/.github/docker-build-config.json" | jq '
def verify_structure:
.components as $components
| .platforms as $platforms
| ($components | type == "array")
and (all($components[]; has("name") and has("file") and has("context")))
and ($platforms | type == "string");
verify_structure
| if . then true else false end
')
if [ ${verify} == 'true' ]; then
echo "✅ $GITHUB_WORKSPACE/.github/docker-build-config.json file is valid"
components=$(jq -c ".components" "$GITHUB_WORKSPACE/.github/docker-build-config.json")
platforms=$(jq -c ".platforms" "$GITHUB_WORKSPACE/.github/docker-build-config.json")
else
echo "❗ $GITHUB_WORKSPACE/.github/docker-build-config.json file is invalid"
echo "❗ $GITHUB_WORKSPACE/.github/docker-build-config.json file is invalid" >> $GITHUB_STEP_SUMMARY
exit 1
fi
echo "components=${components}" >> $GITHUB_OUTPUT
echo "platforms=${platforms}" >> $GITHUB_OUTPUT

docker-check-build:
needs: [load-docker-build-components, check-tag]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
component: ${{ fromJson(needs.load-docker-build-components.outputs.component) }}
steps:
- name: Get version for current component
id: get-version
run: |
echo "IMAGE=${{ matrix.component.name }}" >> $GITHUB_ENV
- name: Docker build
uses: netcracker/qubership-workflow-hub/actions/[email protected]
with:
ref: ${{ github.ref }}
download-artifact: false
dry-run: true
component: ${{ toJson(matrix.component) }}
platforms: ${{ needs.load-docker-build-components.outputs.platforms }}
tags: "${{ env.IMAGE_VERSION }}"
env:
GITHUB_TOKEN: ${{ github.token }}
chart-release-prepare:
needs: [check-tag, load-docker-build-components, docker-check-build]
runs-on: ubuntu-latest
outputs:
images-versions: ${{ steps.update-versions.outputs.images-versions }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Update versions in values"
id: update-versions
uses: netcracker/qubership-workflow-hub/actions/charts-values-update-action@main
with:
release-version: ${{ inputs.release }}
config-file: .github/charts-values-update-config.yaml
env:
${{ insert }}: ${{ vars }}
- name: "Debug"
run: |
echo "Images versions: ${{ steps.update-versions.outputs.images-versions }}"

docker-build:
needs: [chart-release-prepare, load-docker-build-components]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
component: ${{ fromJson(needs.load-docker-build-components.outputs.component) }}
steps:
- name: Get version for current component
id: get-version
run: |
echo "IMAGE_VERSION=${{ fromJson(needs.chart-release-prepare.outputs.images-versions)[matrix.component.name] || inputs.release }}" >> $GITHUB_ENV

- name: Docker build
uses: netcracker/qubership-workflow-hub/actions/[email protected]
with:
ref: release-${{ inputs.release }}
download-artifact: false
dry-run: false
component: ${{ toJson(matrix.component) }}
platforms: ${{ needs.load-docker-build-components.outputs.platforms }}
tags: "${{ env.IMAGE_VERSION }},latest"
env:
GITHUB_TOKEN: ${{ github.token }}
charts-release:
needs: [docker-build]
continue-on-error: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: release-${{ inputs.release }}

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Run chart-releaser
id: chart-releaser
uses: netcracker/chart-releaser-action@main
with:
charts_dir: charts
release_name_template: "{{ .Version }}"
skip_existing: true
skip_upload: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Show chart-releaser output
run: |
echo "::debug::Changed Charts: ${{ steps.chart-releaser.outputs.changed_charts}}"
echo "::debug::Charts versions: ${{ steps.chart-releaser.outputs.chart_version}}"

- name: "Release-drafter"
uses: netcracker/release-drafter@master
with:
config-name: release-drafter-config.yml
publish: true
name: ${{ inputs.release }}
tag: ${{ inputs.release }}
version: ${{ inputs.release }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Assets
uses: netcracker/qubership-workflow-hub/actions/[email protected]
with:
tag: ${{ inputs.release }}
item-path: .cr-release-packages/*.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}