From 4749cc8cce82ebe176df07c138a67eebf00ca4ca Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 9 Jan 2018 12:09:18 -0500 Subject: [PATCH 01/10] Add jenkins dockerfile --- Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dcd9421 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM jenkins/jenkins:lts + +USER root +RUN apt-get -qq update && apt-get -qq -y install \ + curl + +RUN curl -sSL https://get.docker.com/ | sh \ + && rm -rf /var/lib/apt/lists/* + +USER jenkins -- GitLab From 55227c959d5832e56ea21ddc7c0751f9ba2f6b89 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 9 Jan 2018 12:09:35 -0500 Subject: [PATCH 02/10] Add jenkins task --- jenkins.task.json | 57 +++++++++++++++++++++++++++++++++++++++++++++++ readme.md | 13 +++++++++-- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 jenkins.task.json diff --git a/jenkins.task.json b/jenkins.task.json new file mode 100644 index 0000000..6ea10ea --- /dev/null +++ b/jenkins.task.json @@ -0,0 +1,57 @@ +{ + "family": "jenkins", + "networkMode": "bridge", + "containerDefinitions": [ + { + "name": "jenkins-task", + "image": "763311425122.dkr.ecr.us-east-1.amazonaws.com/jenkins:1.0", + "cpu": 1024, + "memoryReservation": 2048, + "links": [], + "portMappings": [ + { + "containerPort": 8080, + "hostPort": 80, + "protocol": "tcp" + } + ], + "essential": true, + "entryPoint": [], + "command": [], + "environment": [], + "mountPoints": [ + { + "sourceVolume": "jenkins_data", + "containerPath": "/var/jenkins_home", + "readOnly": false + }, + { + "sourceVolume": "docker_socket", + "containerPath": "/var/run/docker.sock", + "readOnly": false + } + ], + "volumesFrom": [], + "privileged": true, + "user": "root" + } + ], + "volumes": [ + { + "name": "jenkins_data", + "host": { + "sourcePath": "/home/jenkins/jenkins_data" + } + }, + { + "name": "docker_socket", + "host": { + "sourcePath": "/var/run/docker.sock" + } + } + ], + "placementConstraints": [], + "requiresCompatibilities": [ + "EC2" + ] +} diff --git a/readme.md b/readme.md index f939205..b0c5409 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,17 @@ # Jenkins Docker Image This is the docker image for the BlocPower jenkins image. -## Overview -This image installs awscli, awsebcli, and git. It then configures awscli. Lastly, it runs jenkins pointing to an external RDS instance (so that users and scripts persist across jenkins deployments). +## Docker build & push +aws ecr get-login --no-include-email --region us-east-1 +docker build -t blocp/jenkins . + +docker tag blocp/jenkins:latest 763311425122.dkr.ecr.us-east-1.amazonaws.com/jenkins:latest +docker tag blocp/jenkins:latest 763311425122.dkr.ecr.us-east-1.amazonaws.com/jenkins:1.0 + +docker push 763311425122.dkr.ecr.us-east-1.amazonaws.com/jenkins + +## AWS ECS +aws ecs register-task-definition --cli-input-json file://jenkins.task.json ## aws.ini The AWS configuration is contained in the `aws.ini` file in the top-level directory. This is `.gitignore`d so that the key id and secret are not version controlled. Ask for the key if you need to build this docker image. When Jenkins builds itself, it copies its own `aws.ini` into the repository before building the image. -- GitLab From 4c82997227307927a2bea77d70e71b43b00cfdee Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 10 Jan 2018 22:38:53 -0500 Subject: [PATCH 03/10] Add dependencies and plugins to dockerfile --- Dockerfile | 18 ++++++++++++++++-- plugins.txt | 6 ++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 plugins.txt diff --git a/Dockerfile b/Dockerfile index dcd9421..a3a7ce2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,24 @@ FROM jenkins/jenkins:lts USER root -RUN apt-get -qq update && apt-get -qq -y install \ - curl +RUN apt-get -qq update && apt-get install -y \ + curl \ + moreutils \ + python3 \ + python3-pip \ + jq \ + zip \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install -q \ + awscli \ + awsebcli \ + yq RUN curl -sSL https://get.docker.com/ | sh \ && rm -rf /var/lib/apt/lists/* +COPY plugins.txt /usr/share/jenkins/ref/plugins.txt +RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt + USER jenkins diff --git a/plugins.txt b/plugins.txt new file mode 100644 index 0000000..9be1e6a --- /dev/null +++ b/plugins.txt @@ -0,0 +1,6 @@ +amazon-ecr:1.6 +aws-credentials:1.23 +credentials:2.1.16 +docker-workflow:1.14 +git:3.7.0 +github:1.28.1 -- GitLab From 18544cbcf21b418de45f11094c592ff54787ad7c Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 10 Jan 2018 22:40:40 -0500 Subject: [PATCH 04/10] Mv parsedockerauth to deprecated folder --- parsedockerauth.py => deprecated/parsedockerauth.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename parsedockerauth.py => deprecated/parsedockerauth.py (100%) diff --git a/parsedockerauth.py b/deprecated/parsedockerauth.py similarity index 100% rename from parsedockerauth.py rename to deprecated/parsedockerauth.py -- GitLab From aa663986578c0b7e8d8dcf1892f59d65f4fdf939 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 10 Jan 2018 22:40:58 -0500 Subject: [PATCH 05/10] Delete dockerrun file --- Dockerrun.aws.json | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 Dockerrun.aws.json diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json deleted file mode 100644 index 2284ac5..0000000 --- a/Dockerrun.aws.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "AWSEBDockerrunVersion": "1", - "Authentication": { - "Bucket": "dockerauth.blocpower.org", - "Key": "jenkins.json" - }, - "Image": { - "Name": "blocp/jenkins" - }, - "Volumes": [ - { - "HostDirectory": "/jenkins", - "ContainerDirectory": "/jenkins" - }, - { - "HostDirectory": "/var/run/docker.sock", - "ContainerDirectory": "/var/run/docker.sock" - } - ], - "Ports": [ - { - "HostPort": "80", - "ContainerPort": "8080" - } - ] -} -- GitLab From b06c4460f84f7dacc7749b03c2407ddee9af8dd6 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 10 Jan 2018 22:42:25 -0500 Subject: [PATCH 06/10] :arrow_up: jenkins 1.2 version for task --- jenkins.task.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins.task.json b/jenkins.task.json index 6ea10ea..5b5691c 100644 --- a/jenkins.task.json +++ b/jenkins.task.json @@ -4,7 +4,7 @@ "containerDefinitions": [ { "name": "jenkins-task", - "image": "763311425122.dkr.ecr.us-east-1.amazonaws.com/jenkins:1.0", + "image": "763311425122.dkr.ecr.us-east-1.amazonaws.com/jenkins:1.2", "cpu": 1024, "memoryReservation": 2048, "links": [], -- GitLab From e440f0c13c73c961186b96c121b79400f460286d Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 10 Jan 2018 22:43:51 -0500 Subject: [PATCH 07/10] Rename readme file to uppercase --- readme.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename readme.md => README.md (100%) diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md -- GitLab From 9a7d3d308d35c63467b636c4c3e2928ef86f4ab6 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 10 Jan 2018 23:41:27 -0500 Subject: [PATCH 08/10] Remove docker download and bind docker from host --- Dockerfile | 4 +--- jenkins.task.json | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index a3a7ce2..5f4c2e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM jenkins/jenkins:lts USER root RUN apt-get -qq update && apt-get install -y \ curl \ + libltdl7 \ moreutils \ python3 \ python3-pip \ @@ -15,9 +16,6 @@ RUN pip3 install -q \ awsebcli \ yq -RUN curl -sSL https://get.docker.com/ | sh \ - && rm -rf /var/lib/apt/lists/* - COPY plugins.txt /usr/share/jenkins/ref/plugins.txt RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt diff --git a/jenkins.task.json b/jenkins.task.json index 5b5691c..d503c2d 100644 --- a/jenkins.task.json +++ b/jenkins.task.json @@ -29,6 +29,11 @@ "sourceVolume": "docker_socket", "containerPath": "/var/run/docker.sock", "readOnly": false + }, + { + "sourceVolume": "docker_engine", + "containerPath": "/usr/bin/docker", + "readOnly": false } ], "volumesFrom": [], @@ -48,10 +53,14 @@ "host": { "sourcePath": "/var/run/docker.sock" } + }, + { + "name": "docker_engine", + "host": { + "sourcePath": "/usr/bin/docker" + } } ], "placementConstraints": [], - "requiresCompatibilities": [ - "EC2" - ] + "requiresCompatibilities": [] } -- GitLab From d6a76a5eb47251bbd5bb5ee0d4f39d902a3ecd95 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Mon, 15 Jan 2018 17:40:12 -0500 Subject: [PATCH 09/10] Add plugins --- Dockerfile | 1 + plugins.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5f4c2e4..17fe4f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM jenkins/jenkins:lts USER root + RUN apt-get -qq update && apt-get install -y \ curl \ libltdl7 \ diff --git a/plugins.txt b/plugins.txt index 9be1e6a..5a0f81c 100644 --- a/plugins.txt +++ b/plugins.txt @@ -4,3 +4,5 @@ credentials:2.1.16 docker-workflow:1.14 git:3.7.0 github:1.28.1 +git-parameter:0.9.0 +pipeline-utility-steps:1.5.1 -- GitLab From 3ff05b98ee18ca0fe8cb92082c44099c41c8fdd5 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 16 Jan 2018 19:21:00 -0500 Subject: [PATCH 10/10] Add slack plugin --- plugins.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins.txt b/plugins.txt index 5a0f81c..2350513 100644 --- a/plugins.txt +++ b/plugins.txt @@ -6,3 +6,4 @@ git:3.7.0 github:1.28.1 git-parameter:0.9.0 pipeline-utility-steps:1.5.1 +slack:2.3 -- GitLab