Build Docs: [ ee,de ] non-plugins: [✓] utils: [✓] VER: [9.2.1-2] #186
Workflow file for this run
This file contains hidden or 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 workflow setup instance then build and push images ### | |
| name: Multi-arch build | |
| run-name: >- | |
| Build Docs: [ | |
| ${{ inputs.edition }} | |
| ] | |
| ${{ inputs.docs-balancer && 'balancer: [✓]' || '' }} | |
| ${{ inputs.docs-non-plugins && 'non-plugins: [✓]' || '' }} | |
| ${{ inputs.docs-utils && 'utils: [✓]' || '' }} | |
| VER: [${{ inputs.tag }}] | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| amd64: | |
| type: boolean | |
| description: 'Build amd64' | |
| default: true | |
| arm64: | |
| type: boolean | |
| description: 'Build arm64' | |
| default: true | |
| edition: | |
| description: "Specify Docs edition (ex. 'ee' or 'ee,de') Keep empty if don't need build any Docs edition" | |
| type: string | |
| docs-non-plugins: | |
| type: boolean | |
| description: 'Build Docs-non-plugins' | |
| default: true | |
| docs-utils: | |
| type: boolean | |
| description: 'Build Docs-utils (utils example)' | |
| default: true | |
| docs-balancer: | |
| type: boolean | |
| description: 'Build Docs-balancer' | |
| default: true | |
| tag: | |
| description: 'Specify tag (ex. 7.0.0 or 7.0.0-rc25)' | |
| type: string | |
| required: true | |
| test-repo: | |
| type: boolean | |
| description: 'Push to test-repo' | |
| default: true | |
| version: | |
| type: string | |
| required: false | |
| description: 'Specify version like (ex. 1.0.0). Also can be set with build number (ex. 1.0.0-1)' | |
| package-url: | |
| description: Get package from | |
| required: true | |
| default: prod | |
| type: choice | |
| options: | |
| - s3 | |
| - prod | |
| jobs: | |
| prepare-build: | |
| name: "Prepare build" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| sourceTag: ${{ steps.prepare.outputs.sourceTag }} | |
| dsHash: ${{ steps.prepare.outputs.dsHash }} | |
| matrix: ${{ steps.prepare.outputs.matrix }} | |
| platform: ${{ steps.prepare.outputs.platform }} | |
| steps: | |
| - name: prepare-build | |
| id: prepare | |
| shell: bash | |
| run: | | |
| ### Check that test-repo specifyed with rc postfix ### | |
| if ${{ github.event.inputs.test-repo }}; then | |
| if ! [[ ${{ github.event.inputs.tag }} == *rc* ]]; then | |
| echo -e '\033[33m ⚠ ALERT ⚠ \033[0m' | |
| echo -e 'Test-Repo: enabled[\033[32m✓\033[0m]' | |
| echo -e 'Please specify tag with <rc>...' | |
| echo -e '\033[33mFor example:\033[0m ${{ github.event.inputs.tag }}-rc25' | |
| exit 1 | |
| fi | |
| fi | |
| ### Make build platforms ### | |
| [ ${{ github.event.inputs.amd64 }} = true ] && PLATFORMS+=("amd64") | |
| [ ${{ github.event.inputs.arm64 }} = true ] && PLATFORMS+=("arm64") | |
| PLATFORM=$(echo ${PLATFORMS[*]/#/linux/} | tr ' ' ',') | |
| ### Make build matrix ### | |
| matrix='{"include": []}' | |
| editions=($(printf "%s\n" ${{ github.event.inputs.edition }} | tr ',' ' ')) | |
| for e in ${editions[@]}; do | |
| case ${e} in | |
| ee) | |
| echo "Enable enterprise build..." | |
| matrix=$(echo $matrix | jq '.include += [ | |
| { | |
| "name": "Build Docs Enterprise", | |
| "dockerfile": "Dockerfile", | |
| "edition": "-ee", | |
| "images": "proxy docservice converter adminpanel" | |
| } | |
| ]') | |
| ;; | |
| de) | |
| echo "Enable developer build..." | |
| matrix=$(echo $matrix | jq '.include += [ | |
| { | |
| "name": "Build Docs Developer", | |
| "dockerfile": "Dockerfile", | |
| "edition": "-de", | |
| "images": "proxy docservice converter adminpanel" | |
| } | |
| ]') | |
| ;; | |
| esac | |
| done | |
| if ${{ github.event.inputs.docs-non-plugins }}; then | |
| matrix=$(echo $matrix | jq '.include += [ | |
| { | |
| "name": "Build Docs non-plugins", | |
| "dockerfile": "Dockerfile.noplugins", | |
| "edition": "-de", | |
| "images": "proxy docservice converter", | |
| "postfix": "-noplugins" | |
| } | |
| ]') | |
| fi | |
| if ${{ github.event.inputs.docs-utils }}; then | |
| matrix=$(echo $matrix | jq '.include += [ | |
| { | |
| "name": "Build Docs utils", | |
| "dockerfile": "Dockerfile", | |
| "edition": "", | |
| "images": "example utils" | |
| } | |
| ]') | |
| fi | |
| if ${{ github.event.inputs.docs-balancer }}; then | |
| matrix=$(echo $matrix | jq '.include += [ | |
| { | |
| "name": "Build Docs balancer", | |
| "dockerfile": "Dockerfile.balancer", | |
| "edition": "", | |
| "images": "balancer" | |
| } | |
| ]') | |
| fi | |
| ### Specify outputs ### | |
| echo "dsHash=$(echo -n "$(date +'%Y.%m.%d-%H%M')" | md5sum | awk '{print $1}')" >> "$GITHUB_OUTPUT" | |
| echo "matrix=$(echo $matrix | jq -c)" >> "$GITHUB_OUTPUT" | |
| echo "platform=${PLATFORM[@]}" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: "${{ matrix.name }} ${{ github.event.inputs.tag }}" | |
| runs-on: ubuntu-latest | |
| needs: [prepare-build] | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{fromJSON(needs.prepare-build.outputs.matrix)}} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ inputs.test-repo && secrets.DOCKER_TEST_REGISTRY || 'docker.io' }} | |
| username: ${{ inputs.test-repo && secrets.DOCKER_TEST_USERNAME || secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ inputs.test-repo && secrets.DOCKER_TEST_ACCESS_TOKEN || secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: "${{ matrix.name }}" | |
| env: | |
| REGISTRY: ${{ inputs.test-repo && secrets.DOCKER_TEST_REGISTRY || 'docker.io' }} | |
| DS_VERSION_HASH: ${{ needs.prepare-build.outputs.dsHash }} | |
| TAG: ${{ github.event.inputs.tag }} | |
| PLATFORM: ${{ needs.prepare-build.outputs.platform }} | |
| NOPLUG_POSTFIX: ${{ matrix.postfix }} | |
| DOCKERFILE: ${{ matrix.dockerfile }} | |
| IMAGES: ${{ matrix.images }} | |
| VERSION: ${{ github.event.inputs.version }} | |
| TEST_REPO: ${{ github.event.inputs.test-repo }} | |
| PRODUCT_EDITION: ${{ matrix.edition }} | |
| PACKAGE_URL: ${{ github.event.inputs.package-url }} | |
| run: | | |
| : ${DS_VERSION_HASH:?Should be set!} | |
| if "${TEST_REPO}"; then | |
| echo "Build in repo: 4testing" | |
| export PRODUCT_BASEURL=${{ secrets.PRODUCT_BASEURL_RC }} | |
| export RELEASE_VERSION="-${VERSION}.el7" | |
| fi | |
| if [[ "${TEST_REPO}" != "true" && -n "${VERSION}" ]]; then | |
| echo "Build in repo: hub.docker" | |
| export RELEASE_VERSION="-${VERSION}" | |
| if [[ "${PACKAGE_URL}" == "s3" ]]; then | |
| echo "S3 package url was specified..." | |
| export PREFIX_NAME="4testing-" | |
| export PRODUCT_BASEURL=${{ secrets.PRODUCT_BASEURL_RC }} | |
| export RELEASE_VERSION="-${VERSION}.el7" | |
| fi | |
| fi | |
| docker buildx bake --sbom=true --provenance=mode=max \ | |
| -f docker-bake.hcl ${IMAGES} \ | |
| --push |