/
jcasc.template.yml
137 lines (137 loc) · 4.17 KB
/
jcasc.template.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
jenkins:
systemMessage: "Jenkins configured automatically by Jenkins Configuration as Code plugin (JCasC)."
agentProtocols:
- "JNLP4-connect"
authorizationStrategy:
loggedInUsersCanDoAnything:
allowAnonymousRead: false
clouds:
- ecs:
cluster: "${ecs_cluster_arn}"
jenkinsUrl: "${jenkins_nlb_url}/"
name: "fargate"
regionName: "${region_name}"
credentialsId: "" # not needed but required for jcasc plugin. A role will be used to access the resources.
allowedOverrides: "inheritFrom,label,memory,cpu,image"
templates:
- assignPublicIp: false
cpu: ${example_agent_cpu_memory["cpu"]}
image: "${example_agent_docker_image}"
label: "${example_agent_label}"
launchType: "FARGATE"
platformVersion: "${fargate_platform_version}"
memory: 0
memoryReservation: ${example_agent_cpu_memory["memory"]}
networkMode: "awsvpc" # awsvpc is required for fargate
privileged: false
remoteFSRoot: "/home/jenkins"
securityGroups: "${agents_sg_ids}"
sharedMemorySize: 0
subnets: "${agents_subnet_ids}"
templateName: "example-template"
uniqueRemoteFSRoot: false
taskrole: "${agents_task_role_arn}"
executionRole: "${agents_execution_role_arn}"
logDriver: "awslogs"
logDriverOptions:
- name: "awslogs-region"
value: "${region_name}"
- name: "awslogs-group"
value: "${agents_log_group}"
- name: "awslogs-stream-prefix"
value: "task"
crumbIssuer:
standard:
excludeClientIPFromCrumb: true
disableRememberMe: false
markupFormatter: "plainText"
mode: NORMAL
myViewsTabBar: "standard"
numExecutors: ${jenkins_controller_num_executors}
primaryView:
all:
name: "all"
projectNamingStrategy: "standard"
quietPeriod: 5
scmCheckoutRetryCount: 0
securityRealm:
local:
allowsSignup: false
enableCaptcha: true
users:
- id: "admin"
name: "admin"
password: "${admin_password}"
description: "Jenkins admin user. Created with JCasC"
properties:
- mailer:
emailAddress: "admin@admin.com"
slaveAgentPort: ${jnlp_port}
updateCenter:
sites:
- id: "default"
url: "https://updates.jenkins.io/update-center.json"
views:
- all:
name: "all"
viewsTabBar: "standard"
unclassified:
buildDiscarders:
configuredBuildDiscarders:
- "jobBuildDiscarder"
defaultFolderConfiguration:
healthMetrics:
- worstChildHealthMetric:
recursive: true
scmGit:
createAccountBasedOnEmail: false
showEntireCommitSummaryInChanges: false
useExistingAccountWithSameEmail: false
location:
adminAddress: "address not configured yet <nobody@nowhere>"
url: "${jenkins_public_url}/"
mailer:
charset: "UTF-8"
useSsl: false
useTls: false
pollSCM:
pollingThreadCount: 10
tool:
git:
installations:
- home: "git"
name: "Default"
jobs: # this requires the job-dsl plugin
- script: >
pipelineJob('example') {
description("An example of job configured with JCasC and Job DSL Plugins.")
definition {
cps {
sandbox()
script("""\
pipeline {
agent {
label '${example_agent_label}'
}
stages {
stage ('Caller identity: assumed role') {
steps {
sh "aws sts get-caller-identity"
}
}
stage ('Print env vars') {
steps {
sh "env"
}
}
stage ('Print ECS metadata') {
steps {
sh "echo 'Task Metadata'"
sh "curl -s $ECS_CONTAINER_METADATA_URI_V4/task | jq"
}
}
}
}""".stripIndent())
}
}
}