-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile
54 lines (50 loc) · 1.66 KB
/
Jenkinsfile
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
pipeline {
agent {
dockerfile {
filename 'Dockerfile-deploy'
reuseNode true
}
}
options {
quietPeriod(0)
buildDiscarder(logRotator(numToKeepStr: '20'))
disableConcurrentBuilds()
timestamps()
}
environment {
KV_DEV = credentials('cf-kv-dev')
KV_PROD = credentials('cf-kv-prod')
}
stages {
stage("Deploy main") {
when {
branch 'main'
}
stages {
stage("Install dependencies") {
steps {
script {
sh """
pnpm install
"""
}
}
}
stage ("Wrangler deploy bff") {
steps {
withCredentials([
usernamePassword(credentialsId: 'cf-workers-creds', usernameVariable: 'CLOUDFLARE_ACCOUNT_ID', passwordVariable: 'CLOUDFLARE_API_TOKEN'),
]) {
sh """
sed -i "s/<kv_dev_namespace_id>/$KV_DEV/g" apps/blog-bff/wrangler.toml
sed -i "s/<kv_prod_namespace_id>/$KV_PROD/g" apps/blog-bff/wrangler.toml
npx wrangler deploy --config apps/blog-bff/wrangler.toml --env dev
npx wrangler deploy --config apps/blog-bff/wrangler.toml --env prod
"""
}
}
}
}
}
}
}