From 6ce32c997c9797ec570b10082666f2d7a16e7a8d Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Tue, 16 Jul 2024 18:29:47 +0300 Subject: [PATCH 1/3] ci: sync release.yuaml Signed-off-by: Noam Gal --- .github/workflows/release.yaml | 80 +++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b99ae416a008..64f6f90ddf98 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,8 +5,7 @@ on: tags: - v* branches: - - master - - release-* + - main - dev-* concurrency: @@ -21,13 +20,13 @@ permissions: contents: read jobs: - build-linux-amd64: + build-linux: name: Build & push linux if: github.repository == 'codefresh-io/argo-workflows' runs-on: ubuntu-latest strategy: matrix: - platform: [ linux/amd64 ] + platform: [ linux/amd64, linux/arm64 ] target: [ workflow-controller, argocli, argoexec ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -89,7 +88,7 @@ jobs: build-windows: name: Build & push windows - if: github.repository == 'codefresh-io/argo-workflows' + if: github.repository == 'argoproj/argo-workflows' runs-on: windows-2022 steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -97,7 +96,7 @@ jobs: - name: Login to Quay uses: Azure/docker-login@83efeb77770c98b620c73055fbb59b2847e17dc0 # v1.0.1 with: - registry: quay.io + login-server: quay.io username: ${{ secrets.QUAYIO_USERNAME }} password: ${{ secrets.QUAYIO_PASSWORD }} @@ -108,16 +107,21 @@ jobs: docker_org=$DOCKERIO_ORG tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then + if [ $tag = "main" ]; then tag="latest" fi targets="argoexec" for target in $targets; do image_name="${docker_org}/${target}:${tag}-windows" - docker build --target $target -t $image_name -f Dockerfile.windows . - ## Codefresh - remove dockerhub - # docker push $image_name + docker build \ + --build-arg GIT_COMMIT=$tag \ + --build-arg GIT_BRANCH=$branch \ + --build-arg GIT_TREE_STATE=$tree_state \ + --target $target \ + -t $image_name \ + -f Dockerfile.windows \ + . docker tag $image_name quay.io/$image_name docker push quay.io/$image_name @@ -128,14 +132,14 @@ jobs: name: Push manifest with all images if: github.repository == 'codefresh-io/argo-workflows' runs-on: ubuntu-latest - needs: [ build-linux-amd64, build-linux-arm64, build-windows ] + needs: [ build-linux, build-windows ] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Login to Quay uses: Azure/docker-login@83efeb77770c98b620c73055fbb59b2847e17dc0 # v1.0.1 with: - registry: quay.io + login-server: quay.io username: ${{ secrets.QUAYIO_USERNAME }} password: ${{ secrets.QUAYIO_PASSWORD }} @@ -148,7 +152,7 @@ jobs: docker_org=$DOCKERIO_ORG tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then + if [ $tag = "main" ]; then tag="latest" fi @@ -157,18 +161,13 @@ jobs: image_name="${docker_org}/${target}:${tag}" if [ $target = "argoexec" ]; then - ## Codefresh - remove dockerhub - # docker manifest create $image_name ${image_name}-linux-arm64 ${image_name}-linux-amd64 ${image_name}-windows docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 quay.io/${image_name}-windows else - ## Codefresh - remove dockerhub - # docker manifest create $image_name ${image_name}-linux-arm64 ${image_name}-linux-amd64 docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 fi - ## Codefresh - remove dockerhub - # docker manifest push $image_name docker manifest push quay.io/$image_name + done test-images-linux-amd64: @@ -195,16 +194,17 @@ jobs: TARGET: ${{ matrix.target }} run: | tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then + if [ $tag = "main" ]; then tag="latest" fi image_name="${DOCKERIO_ORG}/${TARGET}:${tag}" + docker pull $image_name docker pull quay.io/$image_name test-images-windows: name: Try pulling windows - if: github.repository == 'codefresh-io/argo-workflows' + if: github.repository == 'argoproj/argo-workflows' runs-on: windows-2022 needs: [ push-images ] steps: @@ -220,7 +220,7 @@ jobs: run: | docker_org=$DOCKERIO_ORG tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then + if [ $tag = "main" ]; then tag="latest" fi @@ -251,28 +251,36 @@ jobs: with: path: ui/node_modules key: ${{ runner.os }}-node-dep-v1-${{ hashFiles('**/yarn.lock') }} - - name: go build cache - uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3 - with: - path: /home/runner/.cache/go-build - key: GOCACHE-v2-${{ hashFiles('**/go.mod') }} - - name: go mod cache - uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3 - with: - path: /home/runner/go/pkg/mod - key: GOMODCACHE-v2-${{ hashFiles('**/go.mod') }} # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions - - run: make release-notes VERSION=${GITHUB_REF##*/} + - run: | + if [ ${GITHUB_REF##*/} = main ]; then + echo "VERSION=latest" >> $GITHUB_ENV + else + echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - run: go install sigs.k8s.io/bom/cmd/bom@v0.2.0 + - run: go install github.com/spdx/spdx-sbom-generator/cmd/generator@v0.0.13 + - run: mkdir -p dist + - run: generator -o dist -p . + - run: yarn --cwd ui install + - run: generator -o dist -p ui + - run: bom generate --image quay.io/argoproj/workflow-controller:$VERSION -o dist/workflow-controller.spdx + - run: bom generate --image quay.io/argoproj/argocli:$VERSION -o dist/argocli.spdx + - run: bom generate --image quay.io/argoproj/argoexec:$VERSION -o dist/argoexec.spdx + # pack the boms into one file to make it easy to download + - run: tar -zcf dist/sbom.tar.gz dist/*.spdx + - run: make release-notes VERSION=$VERSION - run: cat release-notes - - run: make manifests VERSION=${GITHUB_REF##*/} + - run: make manifests VERSION=$VERSION - name: Print image tag (please check it is not `:latest`) run: | grep image: dist/manifests/install.yaml - run: go mod download - - run: make clis STATIC_FILES=true VERSION=${GITHUB_REF##*/} + - run: make clis STATIC_FILES=true VERSION=$VERSION - name: Print version (please check it is not dirty) run: dist/argo-linux-amd64 version - run: make checksums + # https://github.com/softprops/action-gh-release # This will publish the release and upload assets. # If a conflict occurs (because you are not on a tag), the release will not be updated. This is a short coming @@ -289,4 +297,4 @@ jobs: dist/manifests/*.yaml dist/sbom.tar.gz env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c8b03cee36d87484c3ed3c8bc773cd09daec8c49 Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Tue, 16 Jul 2024 18:32:35 +0300 Subject: [PATCH 2/3] ci: sync release.yuaml Signed-off-by: Noam Gal --- .github/workflows/release.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 64f6f90ddf98..0b7bc349d759 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -88,7 +88,7 @@ jobs: build-windows: name: Build & push windows - if: github.repository == 'argoproj/argo-workflows' + if: github.repository == 'codefresh-io/argo-workflows' runs-on: windows-2022 steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -204,7 +204,7 @@ jobs: test-images-windows: name: Try pulling windows - if: github.repository == 'argoproj/argo-workflows' + if: github.repository == 'codefresh-io/argo-workflows' runs-on: windows-2022 needs: [ push-images ] steps: @@ -264,9 +264,9 @@ jobs: - run: generator -o dist -p . - run: yarn --cwd ui install - run: generator -o dist -p ui - - run: bom generate --image quay.io/argoproj/workflow-controller:$VERSION -o dist/workflow-controller.spdx - - run: bom generate --image quay.io/argoproj/argocli:$VERSION -o dist/argocli.spdx - - run: bom generate --image quay.io/argoproj/argoexec:$VERSION -o dist/argoexec.spdx + - run: bom generate --image quay.io/codefresh/workflow-controller:$VERSION -o dist/workflow-controller.spdx + - run: bom generate --image quay.io/codefresh/argocli:$VERSION -o dist/argocli.spdx + - run: bom generate --image quay.io/codefresh/argoexec:$VERSION -o dist/argoexec.spdx # pack the boms into one file to make it easy to download - run: tar -zcf dist/sbom.tar.gz dist/*.spdx - run: make release-notes VERSION=$VERSION From 9b163b6e252387e0ae0da981f99b83287ad6459c Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Tue, 16 Jul 2024 18:34:07 +0300 Subject: [PATCH 3/3] ci: sync release.yuaml Signed-off-by: Noam Gal --- .github/workflows/release.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0b7bc349d759..3e673ac949bd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -199,7 +199,6 @@ jobs: fi image_name="${DOCKERIO_ORG}/${TARGET}:${tag}" - docker pull $image_name docker pull quay.io/$image_name test-images-windows: