diff --git a/.github/workflows/pipeline_set_output_tag.sh b/.github/workflows/pipeline_set_output_tag.sh index ba0618fec..64180034e 100755 --- a/.github/workflows/pipeline_set_output_tag.sh +++ b/.github/workflows/pipeline_set_output_tag.sh @@ -7,7 +7,8 @@ github_ref_name=$2 github_sha=$3 github_base_ref=${4:-""} -DOCKERIMAGETAG="$github_sha" +IMAGETAG="$github_sha" +EXTRATAG="" # These values are wrong on purpose: if we see these default values in the wild, # we will know something happened that shouldn't have VERSION="v0.0.0" @@ -15,25 +16,28 @@ MINORVERSION="v0.0.0" if [ "$github_ref_type" = "branch" ]; then case $github_ref_name in - "main") DOCKERIMAGETAG="stable" + "main") IMAGETAG="stable" ;; - "develop") DOCKERIMAGETAG="latest" + "develop") IMAGETAG="latest" ;; esac - if [ $github_base_ref = "main" ]; then - DOCKERIMAGETAG="stable" - elif [ $github_base_ref != "" ]; then - DOCKERIMAGETAG="latest" + if [ "$github_base_ref" = "main" ]; then + IMAGETAG="stable" + elif [ "$github_base_ref" != "" ]; then + IMAGETAG="latest" fi -fi - -if [ "$github_ref_type" = "tag" ]; then - DOCKERIMAGETAG=$github_ref_name +elif [ "$github_ref_type" = "tag" ]; then + IMAGETAG="$github_ref_name" + EXTRATAG="stable" VERSION=$github_ref_name MINORVERSION=$(echo "$github_ref_name"| cut -d. -f1-2) +else + echo unexpected github_ref_type + exit 1 fi -echo "tag=$DOCKERIMAGETAG" >> "$GITHUB_OUTPUT" +echo "tag=$IMAGETAG" >> "$GITHUB_OUTPUT" +echo "extratag=$EXTRATAG" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "minorversion=$MINORVERSION" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/product_builder.yaml b/.github/workflows/product_builder.yaml index a889b4104..004630222 100644 --- a/.github/workflows/product_builder.yaml +++ b/.github/workflows/product_builder.yaml @@ -2,7 +2,9 @@ name: product_builder on: push: branches: [develop, main] - tags: ['*'] + release: + types: + - "published" pull_request: types: [edited, opened, synchronize, reopened] permissions: @@ -24,7 +26,7 @@ env: KRATOS_WORKING_DIRECTORY: web/kratos GOLANG_WORKING_DIRECTORY: golang concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.sha }} cancel-in-progress: true jobs: conventional_commits: @@ -68,6 +70,7 @@ jobs: cruxui: ${{ steps.filter.outputs.cruxui }} kratos: ${{ steps.filter.outputs.kratos }} tag: ${{ steps.settag.outputs.tag }} + extratag: ${{ steps.settag.outputs.extratag }} version: ${{ steps.settag.outputs.version }} minorversion: ${{ steps.settag.outputs.minorversion }} release: ${{ steps.release.outputs.release }} @@ -519,7 +522,7 @@ jobs: # runs-on: self-hosted container: image: ghcr.io/dyrector-io/dyrectorio/playwright:latest - volumes: ['/var/run/docker.sock:/var/run/docker'] + volumes: ["/var/run/docker.sock:/var/run/docker"] needs: - go_build - crux_build @@ -613,11 +616,11 @@ jobs: # DEBUG: pw:api HUB_PROXY_URL: ${{ secrets.HUB_PROXY_URL }} HUB_PROXY_TOKEN: ${{ secrets.HUB_PROXY_TOKEN }} - E2E_BASE_URL: 'http://dyo-e2e_traefik:8000' - MAILSLURPER_URL: 'http://dyo-e2e_mailslurper:4437' - CRUX_UI_URL: 'http://dyo-e2e_traefik:8000' - KRATOS_URL: 'http://dyo-e2e_kratos:4433' - KRATOS_ADMIN_URL: 'http://dyo-e2e_kratos:4434' + E2E_BASE_URL: "http://dyo-e2e_traefik:8000" + MAILSLURPER_URL: "http://dyo-e2e_mailslurper:4437" + CRUX_UI_URL: "http://dyo-e2e_traefik:8000" + KRATOS_URL: "http://dyo-e2e_kratos:4433" + KRATOS_ADMIN_URL: "http://dyo-e2e_kratos:4434" CI: true run: | npm ci --include=dev --arch=x64 --cache .npm --prefer-offline --no-fund @@ -763,6 +766,15 @@ jobs: crane cp ${GITHUB_REGISTRY}/${CRANE_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crane:${{ needs.gather_changes.outputs.tag }} crane cp ${GITHUB_REGISTRY}/${DAGENT_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/dagent:${{ needs.gather_changes.outputs.tag }} crane cp ${GITHUB_REGISTRY}/${CLI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/dyo:${{ needs.gather_changes.outputs.tag }} + - name: Docker tag extra + if: ${{ needs.gather_changes.outputs.extratag != '' }} + run: | + crane cp ${GITHUB_REGISTRY}/${CRANE_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crane:${{ needs.gather_changes.outputs.extratag }} + crane cp ${GITHUB_REGISTRY}/${DAGENT_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/dagent:${{ needs.gather_changes.outputs.extratag }} + crane cp ${GITHUB_REGISTRY}/${CLI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/dyo:${{ needs.gather_changes.outputs.extratag }} + crane cp ${GITHUB_REGISTRY}/${CRANE_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${CRANE_IMAGE_NAME}:${{ needs.gather_changes.outputs.extratag }} + crane cp ${GITHUB_REGISTRY}/${DAGENT_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${DAGENT_IMAGE_NAME}:${{ needs.gather_changes.outputs.extratag }} + crane cp ${GITHUB_REGISTRY}/${CLI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${CLI_IMAGE_NAME}:${{ needs.gather_changes.outputs.extratag }} - name: Add minor version tag if: github.ref_type == 'tag' run: | @@ -823,12 +835,17 @@ jobs: - name: Docker tag run: | docker tag ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crux:${{ needs.gather_changes.outputs.tag }} + - name: Docker tag extra + if: ${{ needs.gather_changes.outputs.extratag != '' }} + run: | + docker tag ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.extratag }} + docker tag ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crux:${{ needs.gather_changes.outputs.extratag }} - name: Add minor version tag if: github.ref_type == 'tag' run: | docker tag ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crux:${{ needs.gather_changes.outputs.minorversion }} docker tag ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME}:${{ needs.gather_changes.outputs.minorversion }} - - name: Docker tag + - name: Docker push all tags run: | docker push -a ${GITHUB_REGISTRY}/${CRUX_IMAGE_NAME} docker push -a ${DOCKERHUB_REGISTRY}/crux @@ -881,12 +898,17 @@ jobs: - name: Docker tag run: | docker tag ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crux-ui:${{ needs.gather_changes.outputs.tag }} + - name: Docker tag extra + if: ${{ needs.gather_changes.outputs.extratag != '' }} + run: | + docker tag ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.extratag }} + docker tag ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crux-ui:${{ needs.gather_changes.outputs.extratag }} - name: Add minor version tag if: github.ref_type == 'tag' run: | docker tag ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/crux-ui:${{ needs.gather_changes.outputs.minorversion }} docker tag ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME}:${{ needs.gather_changes.outputs.minorversion }} - - name: Docker push + - name: Docker push all tags run: | docker push -a ${GITHUB_REGISTRY}/${CRUX_UI_IMAGE_NAME} docker push -a ${DOCKERHUB_REGISTRY}/crux-ui @@ -939,12 +961,17 @@ jobs: - name: Docker tag run: | docker tag ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/kratos:${{ needs.gather_changes.outputs.tag }} + - name: Docker tag extra + if: ${{ needs.gather_changes.outputs.extratag != '' }} + run: | + docker tag ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.extratag }} + docker tag ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/kratos:${{ needs.gather_changes.outputs.extratag }} - name: Add minor version tag if: github.ref_type == 'tag' run: | docker tag ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${DOCKERHUB_REGISTRY}/kratos:${{ needs.gather_changes.outputs.minorversion }} docker tag ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.tag }} ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME}:${{ needs.gather_changes.outputs.minorversion }} - - name: Docker push + - name: Docker push all tags run: | docker push -a ${GITHUB_REGISTRY}/${KRATOS_IMAGE_NAME} docker push -a ${DOCKERHUB_REGISTRY}/kratos