Skip to content

Commit

Permalink
Revert "[PLATFORM-1298]: Move CI/CD to GHA (#75)"
Browse files Browse the repository at this point in the history
This reverts commit 202b8ac.
  • Loading branch information
cpiemontese committed Oct 13, 2023
1 parent 3aa2f36 commit 1f09366
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 69 deletions.
269 changes: 269 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
---
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.3
commands:
- . /etc/profile.d/ecs-credentials-endpoint
- cache-restore
environment:
BUCKET_NAME: prima-ci-cache
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.3
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.3
commands:
- check-public-docker-images
depends_on:
- git-clone

- name: build-image
image: public.ecr.aws/prima/drone-tools:1.21.3
commands:
- sed -i 's/USER app/USER root/g' ./Dockerfile
- docker build -t prima/prima_tracing.rs-ci:${DRONE_COMMIT} ./
volumes:
- name: docker
path: /var/run/docker.sock
depends_on:
- cache-restore

- name: cargo-deps
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- cargo fetch
environment:
CARGO_HOME: /drone/src/.cargo
depends_on:
- build-image

- name: cargo-format
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- cargo make --profile drone format-ci
environment:
CARGO_HOME: /drone/src/.cargo
depends_on:
- cargo-deps

- name: cargo-clippy-ci
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- cargo make --profile drone clippy-ci
environment:
BUILD_ENV: dev
CARGO_HOME: /drone/src/.cargo
depends_on:
- cargo-format

- name: cargo-test
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- cargo make --profile drone test
environment:
BUILD_ENV: dev
CARGO_HOME: /drone/src/.cargo
CARGO_HTTP_CAINFO: ""
depends_on:
- cargo-clippy-ci

- name: cargo-build
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- cargo make --profile drone build-ci
environment:
BUILD_ENV: dev
CARGO_HOME: /drone/src/.cargo
when:
branch:
exclude:
- master
depends_on:
- cargo-test

- name: cache-cleanup
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- cargo make --profile drone cache-cleanup
when:
branch:
- master
depends_on:
- cargo-build
- cargo-format
- cargo-clippy-ci
- cargo-test

- name: cache-save
image: public.ecr.aws/prima/drone-tools:1.21.3
commands:
- . /etc/profile.d/ecs-credentials-endpoint
- cache-save target
environment:
BUCKET_NAME: prima-ci-cache
volumes:
- name: ecs
path: /etc/profile.d/ecs-credentials-endpoint
- name: docker
path: /var/run/docker.sock
when:
branch:
- master
depends_on:
- cache-cleanup

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.3
commands:
- . /etc/profile.d/ecs-credentials-endpoint
- cache-restore
environment:
BUCKET_NAME: prima-ci-cache
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.3
commands:
- sed -i 's/USER app/USER root/g' ./Dockerfile
- docker build -t prima/prima_tracing.rs-ci:${DRONE_COMMIT} ./
volumes:
- name: docker
path: /var/run/docker.sock
depends_on:
- cache-restore

- name: build-production
image: prima/prima_tracing.rs-ci:${DRONE_COMMIT}
commands:
- . /etc/profile.d/ecs-credentials-endpoint
- ./deploy/build production
environment:
CARGO_AUTH_KEY:
from_secret: cargo_auth_key
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: [email protected]
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: aae1afdb1d2100b696969d10cd473ea681b1ed6c509b5c21364a660c33490f7e

...
24 changes: 0 additions & 24 deletions .github/workflows/cd.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/ci.yml

This file was deleted.

36 changes: 36 additions & 0 deletions deploy/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

#############################################################################
# #
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN #
# #
#############################################################################

# script exit when a command fails
set -o errexit
# catch a command error in pipe execution
set -o pipefail
# exit when try to use undeclared variables
# set -o nounset
# print and expand each command to stdout before executing it
set -o xtrace

if [ $# -eq 0 ]; then
echo "Missing required argument: environment"
exit 1
fi

export ENV=$1
export AWS_DEFAULT_REGION="eu-west-1"
export VERSION="${DRONE_TAG:-$DRONE_COMMIT_SHA}"

version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)

if [[ "$DRONE_TAG" != "$version" ]]; then
echo "Package version $version does not match release version $DRONE_TAG"
exit 1
fi

git checkout .
cargo login "$CARGO_AUTH_KEY"
cargo publish

0 comments on commit 1f09366

Please sign in to comment.