From 3a90fad5c7e2e5dba2643eeb7a10efd6ea23100f Mon Sep 17 00:00:00 2001 From: Simone Cottini Date: Wed, 6 Dec 2023 11:45:59 +0100 Subject: [PATCH] Remove drone.yml file and add retire gha flow (#56) --- .drone.yml | 277 ----------------------------------- .github/workflows/retire.yml | 44 ++++++ 2 files changed, 44 insertions(+), 277 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/retire.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 60ae4c9..0000000 --- a/.drone.yml +++ /dev/null @@ -1,277 +0,0 @@ ---- -kind: pipeline -name: default - -platform: - os: linux - arch: amd64 - -clone: - disable: true - -steps: -- name: git-clone - image: public.ecr.aws/prima/drone-git:1.3-3 - environment: - PLUGIN_DEPTH: 5 - -- name: cache-restore - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - cache-restore - environment: - BUCKET_NAME: prima-ci-cache - CACHE_COMPRESSION_ALGO: gz - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - - name: docker - path: /var/run/docker.sock - depends_on: - - git-clone - -- name: check-secrets - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - check-secrets-grants - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - depends_on: - - git-clone - -- name: check-public-docker-images - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - check-public-docker-images - depends_on: - - git-clone - -- name: build-image - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - sed -i 's/USER app/USER root/g' ./Dockerfile - - docker build -t prima/redact_ex-ci:${DRONE_COMMIT} ./ - environment: - DOCKER_DEFAULT_PLATFORM: linux/amd64 - volumes: - - name: docker - path: /var/run/docker.sock - depends_on: - - cache-restore - -- name: elixir-dependencies - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix deps.get - depends_on: - - build-image - -- name: elixir-compile - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix do clean, compile --all-warnings --warnings-as-errors --ignore-module-conflict --debug-info - environment: - MIX_ENV: test - depends_on: - - elixir-dependencies - -- name: elixir-dep-check - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix deps.unlock --check-unused - environment: - MIX_ENV: test - depends_on: - - elixir-compile - -- name: elixir-format - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix format --check-formatted - environment: - MIX_ENV: test - depends_on: - - elixir-compile - -- name: elixir-test - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix test - environment: - MIX_ENV: test - depends_on: - - elixir-compile - -- name: elixir-credo - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix credo -a --strict - environment: - MIX_ENV: test - depends_on: - - elixir-compile - -- name: elixir-dialyzer - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - mix dialyzer - environment: - MIX_ENV: test - depends_on: - - elixir-compile - -- name: cache-save - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - cache-save _build deps - environment: - BUCKET_NAME: prima-ci-cache - CACHE_COMPRESSION_ALGO: gz - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - - name: docker - path: /var/run/docker.sock - when: - branch: - - master - depends_on: - - elixir-compile - - elixir-format - - elixir-test - - elixir-credo - - elixir-dialyzer - - elixir-dep-check - -volumes: -- name: docker - host: - path: /var/run/docker.sock -- name: ecs - host: - path: /etc/profile.d/ecs-credentials-endpoint - -trigger: - event: - - push - ---- -kind: pipeline -name: build-production - -platform: - os: linux - arch: amd64 - -clone: - disable: true - -steps: -- name: git-clone - image: public.ecr.aws/prima/drone-git:1.3-3 - environment: - PLUGIN_DEPTH: 5 - -- name: cache-restore - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - cache-restore - environment: - BUCKET_NAME: prima-ci-cache - CACHE_COMPRESSION_ALGO: gz - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - - name: docker - path: /var/run/docker.sock - depends_on: - - git-clone - -- name: build-image - image: public.ecr.aws/prima/drone-tools:1.21.11 - commands: - - sed -i 's/USER app/USER root/g' ./Dockerfile - - docker build -t prima/redact_ex-ci:${DRONE_COMMIT} ./ - environment: - DOCKER_DEFAULT_PLATFORM: linux/amd64 - volumes: - - name: docker - path: /var/run/docker.sock - depends_on: - - cache-restore - -- name: build-production - image: prima/redact_ex-ci:${DRONE_COMMIT} - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - ./deploy/build production - environment: - HEX_AUTH_KEY: - from_secret: hex_auth_key - MIX_ENV: dev - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - depends_on: - - build-image - -volumes: -- name: docker - host: - path: /var/run/docker.sock -- name: ecs - host: - path: /etc/profile.d/ecs-credentials-endpoint - -trigger: - event: - - tag - ref: - - refs/tags/*.*.* - ---- -kind: pipeline -name: email-failure - -platform: - os: linux - arch: amd64 - -clone: - disable: true - -steps: -- name: email-failure - image: public.ecr.aws/prima/drone-email - settings: - from: drone@prima.it - host: email-smtp.eu-west-1.amazonaws.com - environment: - PLUGIN_PASSWORD: - from_secret: email_password - PLUGIN_USERNAME: - from_secret: email_username - -trigger: - status: - - failure - target: - exclude: - - qa-stack - - qa-it - - qa - -depends_on: -- default -- build-production - ---- -kind: signature -hmac: 7177518e283697396524cdef457e468292454e6a54d0ef76f57ee892a7f3556c - -... diff --git a/.github/workflows/retire.yml b/.github/workflows/retire.yml new file mode 100644 index 0000000..54c1304 --- /dev/null +++ b/.github/workflows/retire.yml @@ -0,0 +1,44 @@ +on: + workflow_dispatch: + inputs: + reason: + description: Retire reason + required: true + default: invalid + type: choice + options: + - renamed + - deprecated + - security + - invalid + - other + message: + description: Retire message + required: true + default: Version has a breaking bug + type: string + version: + description: Version to retire + required: true + default: x.y.z + type: string + +jobs: + retire: + runs-on: ubuntu-latest + env: + MESSAGE: ${{ inputs.message }} + REASON: ${{ inputs.reason }} + VERSION: ${{ inputs.version }} + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + otp-version: '24' + elixir-version: '1.13' + - run: echo "Attempting to retire version $VERSION" + - run: mix hex.config api_key "$HEX_AUTH_KEY" + env: + HEX_AUTH_KEY: ${{ secrets.HEX_AUTH_KEY }} + - run: mix hex.user whoami + - run: mix hex.retire redact_ex "$VERSION" "$REASON" --message "$MESSAGE"