From e16949e17b99067f8cc3f7478ec09b319d899b30 Mon Sep 17 00:00:00 2001 From: Pavel Anikin Date: Tue, 11 Nov 2025 07:04:52 +0300 Subject: [PATCH 1/2] feat: add dev build workflow and configuration --- .github/dev-build-config.cfg | 40 +++++++++++++ .github/workflows/dev_build.yml | 101 ++++++++++++++++++++++++++++++++ .github/workflows/push.yml | 45 +++++++------- 3 files changed, 164 insertions(+), 22 deletions(-) create mode 100644 .github/dev-build-config.cfg create mode 100644 .github/workflows/dev_build.yml diff --git a/.github/dev-build-config.cfg b/.github/dev-build-config.cfg new file mode 100644 index 0000000..ac038fb --- /dev/null +++ b/.github/dev-build-config.cfg @@ -0,0 +1,40 @@ +{ + "components": [ + { + "name": "qubership-consul-integration-tests", + "file": "integration-tests/docker/Dockerfile", + "context": "" + }, + { + "name": "qubership-consul-disaster-recovery", + "file": "disaster-recovery/docker/Dockerfile", + "context": "disaster-recovery" + }, + { + "name": "qubership-consul-transfer", + "file": "docker-transfer/Dockerfile", + "context": "." + }, + { + "name": "qubership-consul-acl-configurator", + "file": "acl-configurator/consul-acl-configurator-operator/Dockerfile", + "context": "acl-configurator/consul-acl-configurator-operator" + }, + { + "name": "qubership-consul-rest-acl-configurator", + "file": "acl-configurator/rest-acl-configurator/Dockerfile", + "context": "acl-configurator/rest-acl-configurator" + }, + { + "name": "qubership-consul-backup-daemon", + "file": "backup-daemon/docker/Dockerfile", + "context": "backup-daemon" + }, + { + "name": "qubership-consul-remove-tokens", + "file": "remove-tokens/docker/Dockerfile", + "context": "remove-tokens" + } + ], + "platforms": "linux/amd64,linux/arm64" +} diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml new file mode 100644 index 0000000..704735a --- /dev/null +++ b/.github/workflows/dev_build.yml @@ -0,0 +1,101 @@ +name: "CI: Dev Build" +run-name: "Dev image for ${{ github.event.repository.name }}: ${{ github.run_number }} - ${{ github.actor }}" +on: + release: + types: [created] + push: + branches: + - "**" + paths-ignore: + - "docs/**" + - "CODE-OF-CONDUCT.md" + - "CONTRIBUTING.md" + - "LICENSE" + - "README.md" + - "SECURITY.md" + pull_request: + branches: + - "**" + paths-ignore: + - "docs/**" + - "CODE-OF-CONDUCT.md" + - "CONTRIBUTING.md" + - "LICENSE" + - "README.md" + - "SECURITY.md" + workflow_dispatch: + inputs: + tags: + required: false + type: string + default: "" + description: "Tags" + dry-run: + required: true + type: boolean + default: false + description: "Dry run mode" + replace-symbol: + required: false + type: string + default: "_" + description: "Symbol to replace in tags" + +permissions: + contents: read + packages: write + +concurrency: + group: ${{ github.ref_type == 'branch' && format('build-branch-{0}', github.ref_name) || format('build-{0}', github.sha) }} + cancel-in-progress: true + +jobs: + prepare: + name: "Prepare Images and Metadata" + runs-on: ubuntu-latest + outputs: + components: ${{ steps.load.outputs.components }} + platforms: ${{ steps.load.outputs.platforms }} + tags: "${{ steps.meta.outputs.result }}" + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - id: load + run: | + echo "components=$(jq -c '.components' .github/dev-build-config.cfg)" >> "$GITHUB_OUTPUT" + echo "platforms=$(jq -c '.platforms' .github/dev-build-config.cfg)" >> "$GITHUB_OUTPUT" + + - name: Create tags for images + uses: netcracker/qubership-workflow-hub/actions/metadata-action@0f2be042d7c833c6bf60df85732609b7991fb821 #2.0.0 + id: meta + with: + default-template: "{{ref-name}}" + extra-tags: ${{ github.event.inputs.tags }} + replace-symbol: ${{ github.event.inputs.replace-symbol }} + dry-run: ${{ inputs.dry-run }} + + build: + name: Build Docker Images + needs: [prepare] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + component: ${{ fromJson(needs.prepare.outputs.components) }} + steps: + - name: Docker + uses: netcracker/qubership-workflow-hub/actions/docker-action@0f2be042d7c833c6bf60df85732609b7991fb821 #2.0.0 + with: + ref: ${{ github.ref }} + dry-run: ${{ inputs.dry-run }} + download-artifact: false + component: ${{ toJson(matrix.component) }} + platforms: ${{ needs.prepare.outputs.platforms }} + tags: ${{ needs.prepare.outputs.tags }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f0f4806..557fd96 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,28 +4,29 @@ permissions: packages: write actions: read on: - release: - types: [created] - push: - branches: - - '**' - paths-ignore: - - 'docs/**' - - 'CODE-OF-CONDUCT.md' - - 'CONTRIBUTING.md' - - 'LICENSE' - - 'README.md' - - 'SECURITY.md' - pull_request: - branches: - - '**' - paths-ignore: - - 'docs/**' - - 'CODE-OF-CONDUCT.md' - - 'CONTRIBUTING.md' - - 'LICENSE' - - 'README.md' - - 'SECURITY.md' + workflow_dispatch: + # release: + # types: [created] + # push: + # branches: + # - '**' + # paths-ignore: + # - 'docs/**' + # - 'CODE-OF-CONDUCT.md' + # - 'CONTRIBUTING.md' + # - 'LICENSE' + # - 'README.md' + # - 'SECURITY.md' + # pull_request: + # branches: + # - '**' + # paths-ignore: + # - 'docs/**' + # - 'CODE-OF-CONDUCT.md' + # - 'CONTRIBUTING.md' + # - 'LICENSE' + # - 'README.md' + # - 'SECURITY.md' env: TAG_NAME: ${{ github.event.release.tag_name || github.ref }} From fdf9be14644d6923743e28e75cb859792f7da69e Mon Sep 17 00:00:00 2001 From: Pavel Anikin Date: Tue, 11 Nov 2025 09:47:20 +0300 Subject: [PATCH 2/2] fix: handle optional inputs for extra-tags and dry-run in dev build workflow --- .github/workflows/dev_build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml index 704735a..73eb970 100644 --- a/.github/workflows/dev_build.yml +++ b/.github/workflows/dev_build.yml @@ -72,9 +72,8 @@ jobs: id: meta with: default-template: "{{ref-name}}" - extra-tags: ${{ github.event.inputs.tags }} - replace-symbol: ${{ github.event.inputs.replace-symbol }} - dry-run: ${{ inputs.dry-run }} + extra-tags: ${{ github.event.inputs.tags || '' }} + replace-symbol: ${{ github.event.inputs.replace-symbol || '_'}} build: name: Build Docker Images @@ -92,7 +91,7 @@ jobs: uses: netcracker/qubership-workflow-hub/actions/docker-action@0f2be042d7c833c6bf60df85732609b7991fb821 #2.0.0 with: ref: ${{ github.ref }} - dry-run: ${{ inputs.dry-run }} + dry-run: ${{ github.event.inputs.dry-run || github.event_name == 'pull_request' }} download-artifact: false component: ${{ toJson(matrix.component) }} platforms: ${{ needs.prepare.outputs.platforms }}