aboutsummaryrefslogtreecommitdiffstats
path: root/old/tools/moon_jenkins
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2020-06-03 10:06:52 +0200
committerThomas Duval <thomas.duval@orange.com>2020-06-03 10:06:52 +0200
commit7bb53c64da2dcf88894bfd31503accdd81498f3d (patch)
tree4310e12366818af27947b5e2c80cb162da93a4b5 /old/tools/moon_jenkins
parentcbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff)
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com> Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'old/tools/moon_jenkins')
-rw-r--r--old/tools/moon_jenkins/Dockerfile8
-rw-r--r--old/tools/moon_jenkins/README.md37
-rw-r--r--old/tools/moon_jenkins/docker-compose.yml20
-rw-r--r--old/tools/moon_jenkins/images/Create Multibranch Pipeline.pngbin0 -> 55639 bytes
-rw-r--r--old/tools/moon_jenkins/images/Git Source Multibranch Pipeline.pngbin0 -> 31054 bytes
-rw-r--r--old/tools/moon_jenkins/images/Multibranch Pipeline Log.pngbin0 -> 55231 bytes
-rw-r--r--old/tools/moon_jenkins/images/Select Source Multibranch Pipeline.pngbin0 -> 23375 bytes
-rw-r--r--old/tools/moon_jenkins/plugins.txt100
-rw-r--r--old/tools/moon_jenkins/security.groovy20
9 files changed, 185 insertions, 0 deletions
diff --git a/old/tools/moon_jenkins/Dockerfile b/old/tools/moon_jenkins/Dockerfile
new file mode 100644
index 00000000..058f388c
--- /dev/null
+++ b/old/tools/moon_jenkins/Dockerfile
@@ -0,0 +1,8 @@
+FROM jenkinsci/blueocean
+
+ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false"
+
+COPY security.groovy /usr/share/jenkins/ref/init.groovy.d/security.groovy
+
+COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
+RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt \ No newline at end of file
diff --git a/old/tools/moon_jenkins/README.md b/old/tools/moon_jenkins/README.md
new file mode 100644
index 00000000..684b351c
--- /dev/null
+++ b/old/tools/moon_jenkins/README.md
@@ -0,0 +1,37 @@
+# Moon Jenkins
+The aim of this repo is to give a quick way to start with jenkins in containers.
+These were the aims of the automation:
+- minimal interaction with Jenkins GUI - the plugins in plugins.txt are installed automatically, the admin user is setup based on environment variables, proxy variables are inherited from environment
+- the build of the custom image is integrated in the same workflow
+
+## Prerequisites
+- one host running a newer version of the docker-engine
+- docker-compose 1.18.0
+
+## Usage
+- Setup secrets:
+```bash
+export JENKINS_USER=admin
+export JENKINS_PASSWORD=admin
+```
+- Deploy jenkins:
+```bash
+docker-compose up -d
+ ```
+- Test: Jenkins GUI can be available on `http://<docker host IP>:8080`
+
+
+## Pipeline Creation
+You may find bellow an example of pipeline creation using BlueOcean interface.
+As example I used a clone (https://github.com/brutus333/moon.git) of the moon project (https://git.opnfv.org/moon/)
+
+Click on "Create a new job" in the classical Jenkins UI and follow the steps highlighted bellow:
+
+![Create Multibranch Pipeline](images/Create%20Multibranch%20Pipeline.png)
+![Select Source](images/Select%20Source%20Multibranch%20Pipeline.png)
+![Configure Source](images/Git%20Source%20Multibranch%20Pipeline.png)
+![Multibranch Pipeline Log](images/Multibranch%20Pipeline%20Log.png)
+
+Clicking on BlueOcean shows the pipeline in the blueocean interface:
+
+![Blue Ocean Pipeline success](images/blue%20ocean%20success%20pipeline.png)
diff --git a/old/tools/moon_jenkins/docker-compose.yml b/old/tools/moon_jenkins/docker-compose.yml
new file mode 100644
index 00000000..eb9354ce
--- /dev/null
+++ b/old/tools/moon_jenkins/docker-compose.yml
@@ -0,0 +1,20 @@
+version: '3.1'
+
+services:
+ jenkins:
+ build:
+ context: .
+ image: blueocean:v0.4
+ ports:
+ - 8080:8080
+ - 50000:50000
+ environment:
+ - jenkins_user=${JENKINS_USER}
+ - jenkins_password=${JENKINS_PASSWORD}
+ volumes:
+ - jenkins-data:/var/jenkins_home
+ - /var/run/docker.sock:/var/run/docker.sock
+ user: root
+
+volumes:
+ jenkins-data: \ No newline at end of file
diff --git a/old/tools/moon_jenkins/images/Create Multibranch Pipeline.png b/old/tools/moon_jenkins/images/Create Multibranch Pipeline.png
new file mode 100644
index 00000000..c71415c0
--- /dev/null
+++ b/old/tools/moon_jenkins/images/Create Multibranch Pipeline.png
Binary files differ
diff --git a/old/tools/moon_jenkins/images/Git Source Multibranch Pipeline.png b/old/tools/moon_jenkins/images/Git Source Multibranch Pipeline.png
new file mode 100644
index 00000000..dd37f217
--- /dev/null
+++ b/old/tools/moon_jenkins/images/Git Source Multibranch Pipeline.png
Binary files differ
diff --git a/old/tools/moon_jenkins/images/Multibranch Pipeline Log.png b/old/tools/moon_jenkins/images/Multibranch Pipeline Log.png
new file mode 100644
index 00000000..a1905934
--- /dev/null
+++ b/old/tools/moon_jenkins/images/Multibranch Pipeline Log.png
Binary files differ
diff --git a/old/tools/moon_jenkins/images/Select Source Multibranch Pipeline.png b/old/tools/moon_jenkins/images/Select Source Multibranch Pipeline.png
new file mode 100644
index 00000000..eadbe916
--- /dev/null
+++ b/old/tools/moon_jenkins/images/Select Source Multibranch Pipeline.png
Binary files differ
diff --git a/old/tools/moon_jenkins/plugins.txt b/old/tools/moon_jenkins/plugins.txt
new file mode 100644
index 00000000..65bae872
--- /dev/null
+++ b/old/tools/moon_jenkins/plugins.txt
@@ -0,0 +1,100 @@
+ssh-credentials
+git
+blueocean-dashboard
+pipeline-model-api
+pipeline-graph-analysis
+workflow-support
+display-url-api
+blueocean-config
+workflow-cps
+branch-api
+blueocean-i18n
+workflow-job
+blueocean-bitbucket-pipeline
+favorite
+docker-commons
+pipeline-input-step
+blueocean-pipeline-api-impl
+workflow-api
+jackson2-api
+git-client
+blueocean-pipeline-scm-api
+blueocean
+pipeline-build-step
+jquery-detached
+matrix-project
+antisamy-markup-formatter
+pipeline-model-extensions
+docker-workflow
+github
+git-server
+authentication-tokens
+workflow-cps-global-lib
+pipeline-model-definition
+workflow-scm-step
+pipeline-model-declarative-agent
+cloudbees-bitbucket-branch-source
+script-security
+scm-api
+blueocean-rest
+variant
+sse-gateway
+htmlpublisher
+matrix-auth
+pubsub-light
+blueocean-github-pipeline
+token-macro
+credentials
+mercurial
+plain-credentials
+blueocean-events
+github-api
+blueocean-git-pipeline
+structs
+durable-task
+pipeline-milestone-step
+blueocean-pipeline-editor
+blueocean-web
+pipeline-stage-tags-metadata
+ace-editor
+blueocean-commons
+blueocean-jira
+blueocean-rest-impl
+workflow-step-api
+blueocean-personalization
+workflow-basic-steps
+blueocean-display-url
+jira
+pipeline-stage-step
+jsch
+blueocean-jwt
+cloudbees-folder
+credentials-binding
+github-branch-source
+apache-httpcomponents-client-4-api
+blueocean-autofavorite
+workflow-multibranch
+mailer
+workflow-durable-task-step
+junit
+command-launcher
+bouncycastle-api
+build-timeout
+timestamper
+resource-disposer
+ws-cleanup
+ant
+gradle
+pipeline-rest-api
+handlebars
+momentjs
+pipeline-stage-view
+workflow-aggregator
+pipeline-github-lib
+mapdb-api
+subversion
+ssh-slaves
+pam-auth
+ldap
+email-ext
+locale \ No newline at end of file
diff --git a/old/tools/moon_jenkins/security.groovy b/old/tools/moon_jenkins/security.groovy
new file mode 100644
index 00000000..0fb5ff6e
--- /dev/null
+++ b/old/tools/moon_jenkins/security.groovy
@@ -0,0 +1,20 @@
+#!groovy
+
+import jenkins.model.*
+import hudson.security.*
+
+def instance = Jenkins.getInstance()
+
+def user = System.getenv()['jenkins_user']
+def pass = System.getenv()['jenkins_password']
+// Create user account
+def hudsonRealm = new HudsonPrivateSecurityRealm(false)
+hudsonRealm.createAccount(user,pass)
+instance.setSecurityRealm(hudsonRealm)
+
+// Enable matrix auth strategy and set my_user as admin
+def strategy = new GlobalMatrixAuthorizationStrategy()
+strategy.add(Jenkins.ADMINISTER, user)
+instance.setAuthorizationStrategy(strategy)
+
+instance.save()