Skip to content

Commit b172264

Browse files
Merge pull request #1 from kottoson-bah/ecs-jenkins-agent
Ecs jenkins agent
2 parents fc42316 + 9d61fa8 commit b172264

File tree

8 files changed

+313
-3
lines changed

8 files changed

+313
-3
lines changed

jenkins/ecs/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright © 2018 Booz Allen Hamilton. All Rights Reserved.
2+
# This software package is licensed under the Booz Allen Public License. The license can be found in the License file or at http://boozallen.github.io/licenses/bapl
3+
4+
FROM jenkins/jenkins:2.176.2
5+
6+
ENV JAVA_OPTS "-Djenkins.install.runSetupWizard=false"
7+
8+
EXPOSE 8080
9+
EXPOSE 50000
10+
11+
USER root
12+
13+
RUN apt-get update && apt-get -y install jq
14+
15+
# install plugins
16+
COPY resources/plugins/plugins.txt /usr/share/jenkins/ref/plugins.txt
17+
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
18+
19+
# copy in init file
20+
COPY resources/scrips/jenkins_preboot.sh /usr/local/bin/jenkins_preboot.sh
21+
RUN chmod +x /usr/local/bin/jenkins_preboot.sh
22+
23+
COPY resources/scripts/container_entrypoint.sh /usr/local/bin/container_entrypoint.sh
24+
RUN chmod +x /usr/local/bin/container_entrypoint.sh
25+
26+
ENTRYPOINT /usr/local/bin/container_entrypoint.sh

jenkins/ecs/README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
-------------
2-
On Kubernetes
3-
-------------
1+
-------
2+
On ECS
3+
-------

jenkins/ecs/resources/jenkins-configuration/init-jenkins.groovy

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Environment Variables
2+
=====================
3+
4+
ROLE_ACCESS_KEY: Access key for use by ECS plugin; Needs to be set in Jenkins at startup
5+
ROLE_SECRET_KEY: Secret key for use by ECS plugin; Needs to be set in Jenkins at startup
6+
GITHUB_PASSWORD: self explanatory
7+
GITHUB_USERNAME: ditto
8+
AGENT_CLUSTER: ARN for the fargate cluster on which Jenkins agents will be deployed
9+
MASTER_PUBLIC_IP: Public IP for the Jenkins Master
10+
MASTER_PRIVATE_IP: Private IP for the Jenkins Master
11+
AGENT_SECURITY_GROUP: Security group to apply to Jenkins agents; format 'sg-#######'
12+
AGENT_SUBNET: The (private) subnet in which to deploy Jenkins agents; format 'subnet-#######'
13+
14+
15+
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
credentials:
2+
system:
3+
domainCredentials:
4+
- credentials:
5+
- aws:
6+
accessKey: "${ROLE_ACCESS_KEY}"
7+
id: "jenkins-aws"
8+
scope: GLOBAL
9+
secretKey: "${ROLE_SECRET_KEY}"
10+
- usernamePassword:
11+
description: "github"
12+
id: "github"
13+
password: "${GITHUB_PASSWORD}"
14+
scope: GLOBAL
15+
username: "${GITHUB_USERNAME}"
16+
jenkins:
17+
agentProtocols:
18+
- "JNLP4-connect"
19+
- "Ping"
20+
authorizationStrategy:
21+
loggedInUsersCanDoAnything:
22+
allowAnonymousRead: false
23+
clouds:
24+
- ecs:
25+
cluster: "${AGENT_CLUSTER}"
26+
credentialsId: "jenkins-aws"
27+
jenkinsUrl: "${MASTER_PRIVATE_IP}"
28+
name: "Jenkins"
29+
regionName: "us-east-1"
30+
templates:
31+
- assignPublicIp: false
32+
cpu: 512
33+
image: "jenkins/jnlp-slave"
34+
label: "agent"
35+
launchType: "FARGATE"
36+
memory: 0
37+
memoryReservation: 1024
38+
networkMode: "default"
39+
privileged: false
40+
remoteFSRoot: "/home/jenkins"
41+
securityGroups: "${AGENT_SECURITY_GROUP}"
42+
sharedMemorySize: 0
43+
subnets: "${AGENT_SUBNET}"
44+
templateName: "agent"
45+
crumbIssuer:
46+
standard:
47+
excludeClientIPFromCrumb: false
48+
disableRememberMe: false
49+
markupFormatter: "plainText"
50+
mode: NORMAL
51+
myViewsTabBar: "standard"
52+
numExecutors: 0
53+
primaryView:
54+
all:
55+
name: "all"
56+
projectNamingStrategy: "standard"
57+
quietPeriod: 5
58+
remotingSecurity:
59+
enabled: true
60+
scmCheckoutRetryCount: 0
61+
securityRealm:
62+
local:
63+
allowsSignup: false
64+
enableCaptcha: false
65+
users:
66+
- id: "admin"
67+
slaveAgentPort: 50000
68+
updateCenter:
69+
sites:
70+
- id: "default"
71+
url: "https://updates.jenkins.io/update-center.json"
72+
views:
73+
- all:
74+
name: "all"
75+
viewsTabBar: "standard"
76+
security:
77+
apiToken:
78+
creationOfLegacyTokenEnabled: false
79+
tokenGenerationOnCreationEnabled: false
80+
usageStatisticsEnabled: true
81+
downloadSettings:
82+
useBrowser: false
83+
sSHD:
84+
port: -1
85+
unclassified:
86+
buildStepOperation:
87+
enabled: false
88+
extendedEmailPublisher:
89+
adminRequiredForTemplateTesting: false
90+
allowUnregisteredEnabled: false
91+
charset: "UTF-8"
92+
debugMode: false
93+
defaultBody: "$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:\r\n\r\nCheck\
94+
\ console output at $BUILD_URL to view the results."
95+
defaultContentType: "text/plain"
96+
defaultSubject: "$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
97+
maxAttachmentSize: -1
98+
maxAttachmentSizeMb: 0
99+
precedenceBulk: false
100+
useSsl: false
101+
watchingEnabled: false
102+
gitHubPluginConfig:
103+
hookUrl: "http://${MASTER_PUBLIC_IP}:8080/github-webhook/"
104+
gitSCM:
105+
createAccountBasedOnEmail: false
106+
location:
107+
adminAddress: "address not configured yet <nobody@nowhere>"
108+
url: "http://${MASTER_PUBLIC_IP}:8080/"
109+
mailer:
110+
adminAddress: "address not configured yet <nobody@nowhere>"
111+
charset: "UTF-8"
112+
useSsl: false
113+
pollSCM:
114+
pollingThreadCount: 10
115+
templateGlobalConfig:
116+
tier:
117+
scm: "none"
118+
timestamperConfig:
119+
allPipelines: false
120+
elapsedTimeFormat: "'<b>'HH:mm:ss.S'</b> '"
121+
systemTimeFormat: "'<b>'HH:mm:ss'</b> '"
122+
tool:
123+
git:
124+
installations:
125+
- home: "git"
126+
name: "Default"
+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
ace-editor:1.1
2+
amazon-ecs:1.22
3+
analysis-core:1.96
4+
ant:1.9
5+
antisamy-markup-formatter:1.5
6+
apache-httpcomponents-client-4-api:4.5.5-3.0
7+
artifactory:3.3.2
8+
authentication-tokens:1.3
9+
blueocean:1.18.1
10+
blueocean-autofavorite:1.2.4
11+
blueocean-bitbucket-pipeline:1.18.1
12+
blueocean-commons:1.18.1
13+
blueocean-config:1.18.1
14+
blueocean-core-js:1.18.1
15+
blueocean-dashboard:1.18.1
16+
blueocean-display-url:2.3.0
17+
blueocean-events:1.18.1
18+
blueocean-executor-info:1.18.1
19+
blueocean-git-pipeline:1.18.1
20+
blueocean-github-pipeline:1.18.1
21+
blueocean-i18n:1.18.1
22+
blueocean-jira:1.18.1
23+
blueocean-jwt:1.18.1
24+
blueocean-personalization:1.18.1
25+
blueocean-pipeline-api-impl:1.18.1
26+
blueocean-pipeline-editor:1.18.1
27+
blueocean-pipeline-scm-api:1.18.1
28+
blueocean-rest:1.18.1
29+
blueocean-rest-impl:1.18.1
30+
blueocean-web:1.18.1
31+
bouncycastle-api:2.17
32+
branch-api:2.5.4
33+
build-timeout:1.19
34+
cloudbees-bitbucket-branch-source:2.4.5
35+
cloudbees-folder:6.9
36+
command-launcher:1.3
37+
config-file-provider:3.6.2
38+
configuration-as-code:1.27
39+
configuration-as-code-groovy:1.1
40+
credentials:2.2.1
41+
credentials-binding:1.20
42+
dependency-check-jenkins-plugin:5.0.2
43+
dependency-track:2.1.0
44+
display-url-api:2.3.2
45+
docker-commons:1.15
46+
docker-workflow:1.19
47+
durable-task:1.30
48+
email-ext:2.66
49+
favorite:2.3.2
50+
filesystem_scm:2.1
51+
git:3.12.0
52+
git-client:2.8.0
53+
git-server:1.8
54+
github:1.29.4
55+
github-api:1.95
56+
github-branch-source:2.5.6
57+
google-kubernetes-engine:0.6.3
58+
google-metadata-plugin:0.2
59+
google-oauth-plugin:0.8
60+
google-source-plugin:0.3
61+
gradle:1.33
62+
handlebars:1.1.1
63+
handy-uri-templates-2-api:2.1.7-1.0
64+
htmlpublisher:1.18
65+
ivy:2.1
66+
jackson2-api:2.9.9.1
67+
javadoc:1.5
68+
jdk-tool:1.3
69+
jenkins-design-language:1.18.1
70+
jira:3.0.9
71+
job-dsl:1.75
72+
jquery:1.12.4-1
73+
jquery-detached:1.2.1
74+
jsch:0.1.55.1
75+
junit:1.28
76+
kubernetes-credentials:0.4.1
77+
ldap:1.20
78+
lockable-resources:2.5
79+
mailer:1.24
80+
mapdb-api:1.0.9.0
81+
matrix-auth:2.4.2
82+
matrix-project:1.14
83+
maven-plugin:3.4
84+
mercurial:2.8
85+
momentjs:1.1.1
86+
oauth-credentials:0.3
87+
openshift-client:1.0.32
88+
openshift-login:1.0.19
89+
pam-auth:1.5.1
90+
pipeline-build-step:2.9
91+
pipeline-github-lib:1.0
92+
pipeline-graph-analysis:1.10
93+
pipeline-input-step:2.10
94+
pipeline-milestone-step:1.3.1
95+
pipeline-model-api:1.3.9
96+
pipeline-model-declarative-agent:1.1.1
97+
pipeline-model-definition:1.3.9
98+
pipeline-model-extensions:1.3.9
99+
pipeline-rest-api:2.12
100+
pipeline-stage-step:2.3
101+
pipeline-stage-tags-metadata:1.3.9
102+
pipeline-stage-view:2.12
103+
pipeline-utility-steps:2.3.0
104+
plain-credentials:1.5
105+
pubsub-light:1.13
106+
resource-disposer:0.13
107+
scm-api:2.6.3
108+
script-security:1.62
109+
sonar:2.9
110+
sse-gateway:1.19
111+
ssh-credentials:1.17.1
112+
ssh-slaves:1.30.1
113+
structs:1.20
114+
subversion:2.12.2
115+
swarm:3.17
116+
templating-engine:1.3
117+
timestamper:1.10
118+
token-macro:2.8
119+
variant:1.3
120+
windows-slaves:1.4
121+
workflow-aggregator:2.6
122+
workflow-api:2.36
123+
workflow-basic-steps:2.18
124+
workflow-cps:2.73
125+
workflow-cps-global-lib:2.15
126+
workflow-durable-task-step:2.33
127+
workflow-job:2.33
128+
workflow-multibranch:2.21
129+
workflow-remote-loader:1.5
130+
workflow-scm-step:2.9
131+
workflow-step-api:2.20
132+
workflow-support:3.3
133+
ws-cleanup:0.37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash -e
2+
3+
/usr/local/bin/jenkins_preboot.sh
4+
5+
/sbin/tini -- /usr/local/bin/jenkins.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash -e
2+
3+
if [[ -n $AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ]]; then
4+
5+
done;

0 commit comments

Comments
 (0)