forked from ktruckenmiller/ecs-cluster-deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.jsonnet
76 lines (74 loc) · 2 KB
/
.drone.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
local Bucket(region, env) = {
name: "upload-linux-"+region,
image: "plugins/s3",
depends_on: [ "zip-linux" ],
settings: {
access_key: {
from_secret: "access_key"
},
secret_key: {
from_secret: "secret_key"
},
bucket: "kloudcover-public-"+region+"-601394826940",
acl: "public-read",
region: region,
source: "deployment.zip",
target: if env == "dev" then "ecs_cluster_deployer/${DRONE_COMMIT}" else "ecs_cluster_deployer/${DRONE_TAG}"
}
};
local Pipeline(env) = {
kind: "pipeline",
trigger: {
event: if env == "dev" then ["push"] else ["tag"]
},
name: "deploy-"+env,
steps: [
{
name: "test-deployer",
image: "python:alpine",
environment: {
"AWS_DEFAULT_REGION": "us-west-2"
},
commands: [
"apk add git gcc musl-dev libffi-dev openssl-dev",
"pip install -r requirements-dev.pip",
"pylint ecs_cluster_deployer",
"pytest --cov-report term --cov=ecs_cluster_deployer tests/ -W ignore::DeprecationWarning"
]
}, {
name: "zip-linux",
depends_on: [ "test-deployer" ],
image: "alpine",
commands: [
"apk add zip unzip",
"cd ecs_cluster_deployer/lambdas && zip -r deployment.zip *",
"mv deployment.zip ../../deployment.zip"
]
},
Bucket("us-east-1", env),
Bucket("us-west-2", env),
Bucket("us-east-2", env),
{
name: "build-docker",
image: "plugins/docker",
depends_on: [ "upload-linux-us-east-1"],
settings: {
repo: "ktruckenmiller/ecs-cluster-deployer",
tags: if env == "dev" then ["latest", "${DRONE_COMMIT}"] else ["${DRONE_TAG}"],
build_args: [
if env == "dev" then "ECS_CLUSTER_DEPLOYER_VERSION=${DRONE_COMMIT}" else "ECS_CLUSTER_DEPLOYER_VERSION=${DRONE_TAG}"
],
username: {
from_secret: "username",
},
password: {
from_secret: "password"
}
}
}
]
};
[
Pipeline("dev"),
Pipeline("prod")
]