From 11c8498e46d4c4ba806f36dc64c93aaf4347a7ef Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 10 Oct 2024 14:32:31 +0200 Subject: [PATCH] rm gitlab ci, add concurrency --- .github/workflows/docker-build-push.yml | 2 +- .github/workflows/gitspiegel-trigger.yml | 22 ---- .github/workflows/smoke_test.yml | 12 ++- .github/workflows/test.yml | 6 +- .gitlab-ci.yml | 128 ----------------------- 5 files changed, 13 insertions(+), 157 deletions(-) delete mode 100644 .github/workflows/gitspiegel-trigger.yml delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index dd9d46a..ba51d0a 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -8,7 +8,7 @@ on: - main concurrency: - group: check-semver-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: diff --git a/.github/workflows/gitspiegel-trigger.yml b/.github/workflows/gitspiegel-trigger.yml deleted file mode 100644 index dce3aaf..0000000 --- a/.github/workflows/gitspiegel-trigger.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: gitspiegel sync - -# This workflow doesn't do anything, it's only use is to trigger "workflow_run" -# webhook, that'll be consumed by gitspiegel -# This way, gitspiegel won't do mirroring, unless this workflow runs, -# and running the workflow is protected by GitHub - -on: - pull_request: - types: - - opened - - synchronize - - unlocked - - ready_for_review - - reopened - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Do nothing - run: echo "let's go" diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index 598c536..9abd820 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -2,6 +2,9 @@ name: Run smoke test on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: smoke_test: @@ -9,8 +12,8 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v3 - - name: Install minikube helmfile and plugins - run : | + - name: Install minikube helmfile and plugins + run: | curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 install minikube-linux-amd64 /usr/local/bin/minikube minikube version @@ -20,7 +23,7 @@ jobs: helm plugin install https://github.com/databus23/helm-diff - name: setup - run : | + run: | cd local-kubernetes make kube make install @@ -29,7 +32,7 @@ jobs: kubectl get pod -n rococo - name: Tests - run : | + run: | pwd (cd local-kubernetes && make web-ci) pwd @@ -39,4 +42,3 @@ jobs: with: name: web path: output - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 427cd63..0a598f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,10 @@ name: Run tests on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-22.04 @@ -21,7 +25,7 @@ jobs: virtualenvs-create: true virtualenvs-in-project: true - name: Run tests - run : | + run: | # PyYaml is required until docker-compose is migrated to v2 pip install pyyaml==5.3.1 pip install docker==6.1.3 docker-compose diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index dd5cfa4..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,128 +0,0 @@ -stages: - - test - - build - - publish - - deploy - -default: - interruptible: true - retry: - max: 2 - when: - - runner_system_failure - - unknown_failure - - api_failure - tags: - - kubernetes-parity-build - -variables: - IMAGE_NAME: "paritytech/testnet-manager" - DOCKERFILE: "Dockerfile" - BUILDAH_IMAGE: "docker.io/paritytech/buildah:1.31" - BUILDAH_COMMAND: "buildah --storage-driver overlay2" - -.test-refs: &test-refs - rules: - - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - -.publish-refs: &publish-refs - rules: - - if: $CI_COMMIT_REF_NAME == "main" # on commits to main branch - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # on tags (i.e. v1.0, v2.1rc1) - -.release-refs: &release-refs - rules: - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # on tags (i.e. v1.0, v2.1rc1) - -.build-only-docker-image: &build-only-docker-image - image: $BUILDAH_IMAGE - script: - - $BUILDAH_COMMAND build - --format=docker - --build-arg VCS_REF="${CI_COMMIT_SHA}" - --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" - --build-arg PROJECT_NAME="${CI_PROJECT_NAME}" - --tag "$IMAGE_NAME:latest" - --file "$DOCKERFILE" . - -.image_version: - script: - # version is either "main-" or tag - - if [[ $CI_COMMIT_REF_NAME == "main" ]]; - then - export VERSION=$CI_COMMIT_REF_NAME-${CI_COMMIT_SHORT_SHA}; - else - export VERSION=$CI_COMMIT_REF_NAME; - fi; - echo "VERSION=$VERSION" - -.deploy-with-argocd: &deploy-with-argocd - stage: deploy - image: argoproj/argocd:v2.6.7 - variables: - ARGOCD_OPTS: --grpc-web --grpc-web-root-path /$DOMAIN - script: - - !reference [.image_version, script] - - argocd app list - - argocd app set $APP --helm-set testnet-manager.image.tag=$VERSION - - argocd app sync $APP --async - #- argocd app wait $APP --timeout 300 --sync - -build-docker-bot: - stage: build - <<: *test-refs - <<: *build-only-docker-image - -build-push-image: - stage: publish - <<: *publish-refs - image: $BUILDAH_IMAGE - variables: - DOCKER_USER: $Docker_Hub_User_Parity - DOCKER_PASS: $Docker_Hub_Pass_Parity - script: - - !reference [.image_version, script] - - test "$DOCKER_USER" -a "$DOCKER_PASS" || - ( echo "no docker credentials provided"; exit 1 ) - - echo "__version__ = '$VERSION'" > app/__init__.py - - $BUILDAH_COMMAND build - --format=docker - --build-arg VCS_REF="${CI_COMMIT_SHA}" - --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" - --build-arg IMAGE_NAME="${IMAGE_NAME}" - --tag "$IMAGE_NAME:latest" - --tag "$IMAGE_NAME:$VERSION" - --file $DOCKERFILE . - # The job will success only on the protected branch - - echo "$DOCKER_PASS" | - buildah login --username "$DOCKER_USER" --password-stdin docker.io - - $BUILDAH_COMMAND info - - $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:latest" - - $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:$VERSION" - after_script: - - buildah logout --all - - -deploy-to-versi: - <<: *publish-refs - extends: .deploy-with-argocd - environment: parity-versi - variables: - DOMAIN: parity-versi - APP: testnet-manager - -deploy-to-rococo: - <<: *release-refs - extends: .deploy-with-argocd - environment: parity-testnet-rococo - variables: - DOMAIN: parity-testnet - APP: testnet-manager-rococo - -deploy-to-westend: - <<: *release-refs - extends: .deploy-with-argocd - environment: parity-testnet-westend - variables: - DOMAIN: parity-testnet - APP: testnet-manager-westend \ No newline at end of file