Skip to content
Merged
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
45 changes: 0 additions & 45 deletions .github/workflows/build.yaml

This file was deleted.

207 changes: 194 additions & 13 deletions .github/workflows/helm-charts-release.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,226 @@
---

name: Helm Charts Release
on:
workflow_dispatch:
inputs:
release:
description: "Release version (e.g. v0.35.2)"
description: "Release version (e.g. 0.35.2, or test-<id> for test builds)"
required: true
type: string
publish_release:
description: "Publish a real GitHub Release for this run — set to false for test dispatches from a non-main branch"
required: false
type: boolean
default: true

permissions:
contents: write
packages: write
contents: read

run-name: ${{ github.repository }} Release ${{ inputs.release }}
run-name: ${{ github.repository }} Release ${{ github.event.inputs.release }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish-artifacts:
uses: ./.github/workflows/publish.yaml
with:
tag: ${{ inputs.release }}
secrets: inherit
check-tag:
runs-on: ubuntu-latest
steps:
- name: Check if tag exists
id: check_tag
uses: netcracker/qubership-workflow-hub/actions/tag-action@8d542a426ce561c7dce745f6b9cee068d1d7e101 # v2.0.10
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 }}
env:
CONFIG_FILE: .qubership/docker-build-config.cfg
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false

- name: Load Docker Configuration
id: load_component
run: |
verify=$(cat "$GITHUB_WORKSPACE/${CONFIG_FILE}" | 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/${CONFIG_FILE} file is valid"
components=$(jq -c ".components" "$GITHUB_WORKSPACE/${CONFIG_FILE}")
platforms=$(jq -c ".platforms" "$GITHUB_WORKSPACE/${CONFIG_FILE}")
else
echo "❗ $GITHUB_WORKSPACE/${CONFIG_FILE} file is invalid"
echo "❗ $GITHUB_WORKSPACE/${CONFIG_FILE} 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]
name: ${{ matrix.component.name }} dry run
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/docker-action@8d542a426ce561c7dce745f6b9cee068d1d7e101 # v2.0.10
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:
permissions:
contents: write
packages: write
needs: [check-tag, load-docker-build-components, docker-check-build]
runs-on: ubuntu-latest
outputs:
images-versions: ${{ steps.update-versions.outputs.images-versions }}
charts-artifact: ${{ steps.update-versions.outputs.released-chart-atrifact }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
persist-credentials: true

- name: "Add github.vars into github.env"
env:
VARS_JSON: '${{ toJson(vars) }}'
run: |
echo "${VARS_JSON}" | jq -r 'to_entries|map("\(.key)=\(.value)")|.[]' >> $GITHUB_ENV

- name: "Compute chart version"
id: chart-version
run: |
RELEASE="${{ inputs.release }}"
if [[ "$RELEASE" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
CHART_VERSION="$RELEASE"
else
SANITIZED=$(echo "$RELEASE" | sed -E 's/[^0-9A-Za-z-]/-/g')
CHART_VERSION="0.0.0-${SANITIZED}"
fi
echo "chart_version=${CHART_VERSION}" >> "$GITHUB_OUTPUT"

- name: "Chart release"
id: update-versions
uses: netcracker/qubership-workflow-hub/actions/charts-values-update-action@6b356d28e46b2d4683cccb1d91f92643d7f0c513 # v.2.0.11
with:
release-version: ${{ inputs.release }}
chart-version: ${{ steps.chart-version.outputs.chart_version }}
config-file: .qubership/helm-charts-release-config.yaml
default-tag: ${{ inputs.release }}
package-charts: true
publish-charts: true

- name: "Debug"
env:
IMAGES_VERSIONS: "${{ steps.update-versions.outputs.images-versions }}"
run: |
echo "Images versions: ${IMAGES_VERSIONS}"
ls -laR

docker-build:
name: ${{ matrix.component.name }}
permissions:
contents: write
packages: write
needs: [chart-release, 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
env:
IMAGE_VER: "${{ fromJson(needs.chart-release.outputs.images-versions)[matrix.component.name] || inputs.release }}"
run: |
echo "IMAGE_VERSION=${IMAGE_VER}" >> $GITHUB_ENV

- name: Docker build
uses: netcracker/qubership-workflow-hub/actions/docker-action@8d542a426ce561c7dce745f6b9cee068d1d7e101 # v2.0.10
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 }}

github-release:
needs: [publish-artifacts]
if: ${{ inputs.publish_release }}
permissions:
contents: write
packages: write
pull-requests: write
needs: [chart-release, docker-build]
continue-on-error: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Checkout code"
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
ref: release-${{ inputs.release }}
persist-credentials: true

- name: Create GitHub release
- name: "Release-drafter"
uses: netcracker/release-drafter@86f4276a3894b5af70480e826c32fe3648ac6a70 # v1.0.0
with:
config-name: release-drafter-config.yml
publish: true
name: ${{ inputs.release }}
tag: ${{ inputs.release }}
version: ${{ inputs.release }}
commitish: release-${{ inputs.release }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Download released charts"
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
artifact-ids: ${{ needs.chart-release.outputs.charts-artifact }}
- name: "Upload Assets"
uses: netcracker/qubership-workflow-hub/actions/assets-action@8d542a426ce561c7dce745f6b9cee068d1d7e101 # v2.0.10
with:
tag: ${{ inputs.release }}
item-path: "./*.tgz"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 0 additions & 70 deletions .github/workflows/publish.yaml

This file was deleted.

Loading
Loading