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..73eb970 --- /dev/null +++ b/.github/workflows/dev_build.yml @@ -0,0 +1,100 @@ +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 || '_'}} + + 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: ${{ github.event.inputs.dry-run || github.event_name == 'pull_request' }} + 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 }}