From e36530db07911ba858da4120274feab59041ff4d Mon Sep 17 00:00:00 2001
From: Pavlina Bortlova <pbortlov@redhat.com>
Date: Mar 11 2020 11:33:12 +0000
Subject: [PATCH 1/3] Add jenkins install/delete to Makefile


---

diff --git a/c3iaas/Makefile b/c3iaas/Makefile
index cf10dd9..bf47090 100644
--- a/c3iaas/Makefile
+++ b/c3iaas/Makefile
@@ -24,6 +24,22 @@ install:
 			--param-file ./$(JOBS_DIR)/$${job}.env | $(OC_CMD) apply -f -; \
 		echo "[PIPELINE] Pipeline job \"$${job}\" updated" ; \
 	done
+
+create-jenkins-is:
+	$(OC_CMD) import-image jenkins:2 --confirm --scheduled=true \
+		--from=registry.access.redhat.com/openshift3/jenkins-2-rhel7:v3.11
+
+install-jenkins: create-jenkins-is
+	$(OC_CMD) new-app --template=jenkins-persistent \
+		-p MEMORY_LIMIT=2Gi \
+		-p VOLUME_CAPACITY=2Gi \
+		-p NAMESPACE=$(shell $(OC_CMD) project -q) \
+		-e INSTALL_PLUGINS=$(shell cat jenkins-plugins.txt) \
+		-e JENKINS_JAVA_OVERRIDES="-Dpermissive-script-security.enabled=no_security"
+
+uninstall-jenkins:
+	$(OC_CMD) delete -l app=jenkins-persistent all,sa,rolebindings,pvc
+
 uninstall:
 	@for job in $(JOBS); do \
 		echo "[PIPELINE] Deleting pipeline job \"$${job}\"..." ; \
diff --git a/c3iaas/jenkins-plugins.txt b/c3iaas/jenkins-plugins.txt
new file mode 100644
index 0000000..7ace28c
--- /dev/null
+++ b/c3iaas/jenkins-plugins.txt
@@ -0,0 +1,47 @@
+openshift-login:latest\
+openshift-client:latest\
+openshift-sync:latest\
+kubernetes:latest\
+credentials:latest\
+docker-commons:latest\
+pipeline-model-definition:latest\
+lockable-resources:latest\
+config-file-provider:latest\
+htmlpublisher:latest\
+job-dsl:latest\
+mailer:latest\
+parameterized-trigger:latest\
+pipeline-build-step:latest\
+pipeline-input-step:latest\
+script-security:latest\
+ant:latest\
+pam-auth:latest\
+git-client:latest\
+credentials-binding:latest\
+junit:latest\
+workflow-support:latest\
+git:latest\
+mercurial:latest\
+subversion:latest\
+github:latest\
+github-branch-source:latest\
+workflow-cps:latest\
+workflow-cps-global-lib:latest\
+token-macro:latest\
+workflow-remote-loader:latest\
+mapdb-api:latest\
+matrix-project:latest\
+ssh-credentials:latest\
+pipeline-utility-steps:latest\
+pipeline-github-lib:latest\
+github-organization-folder:latest\
+matrix-auth:latest\
+blueocean:latest\
+workflow-aggregator:latest\
+metrics:latest\
+script-security:latest\
+permissive-script-security:latest\
+timestamper:latest\
+http_request:latest\
+antisamy-markup-formatter:latest\
+update-sites-manager:latest

From 0b64c44a03aef1672af3da5804b923769a98ce54 Mon Sep 17 00:00:00 2001
From: Pavlina Bortlova <pbortlov@redhat.com>
Date: Mar 12 2020 09:29:33 +0000
Subject: [PATCH 2/3] Consolidate jenkins plugins


---

diff --git a/c3iaas/Makefile b/c3iaas/Makefile
index bf47090..7d0cbfc 100644
--- a/c3iaas/Makefile
+++ b/c3iaas/Makefile
@@ -29,15 +29,18 @@ create-jenkins-is:
 	$(OC_CMD) import-image jenkins:2 --confirm --scheduled=true \
 		--from=registry.access.redhat.com/openshift3/jenkins-2-rhel7:v3.11
 
-install-jenkins: create-jenkins-is
+get-jenkins-plugins:
+	$(shell ./get-all-jenkins-plugins.sh)
+
+install-jenkins: create-jenkins-is get-jenkins-plugins
 	$(OC_CMD) new-app --template=jenkins-persistent \
 		-p MEMORY_LIMIT=2Gi \
 		-p VOLUME_CAPACITY=2Gi \
 		-p NAMESPACE=$(shell $(OC_CMD) project -q) \
-		-e INSTALL_PLUGINS=$(shell cat jenkins-plugins.txt) \
+		-e INSTALL_PLUGINS=$(shell cat default-jenkins-plugins.txt) \
 		-e JENKINS_JAVA_OVERRIDES="-Dpermissive-script-security.enabled=no_security"
 
-uninstall-jenkins:
+remove-jenkins:
 	$(OC_CMD) delete -l app=jenkins-persistent all,sa,rolebindings,pvc
 
 uninstall:
@@ -48,4 +51,4 @@ uninstall:
 			--param-file ./$(JOBS_DIR)/$${job}.env | $(OC_CMD) delete -f -; \
 		echo "[PIPELINE] Pipeline job \"$${job}\" deleted" ; \
 	done
-.PHONY: help install uninstall
+.PHONY: help install install-jenkins remove-jenkins uninstall
diff --git a/c3iaas/get-all-jenkins-plugins.sh b/c3iaas/get-all-jenkins-plugins.sh
new file mode 100755
index 0000000..14e1804
--- /dev/null
+++ b/c3iaas/get-all-jenkins-plugins.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+curl https://raw.githubusercontent.com/openshift/jenkins/master/2/contrib/openshift/base-plugins.txt | grep -vE "(#|prometheus)" |grep -v '^$' | sed 's/:.*/:latest/'| tr '\n' ',' > default-jenkins-plugins.txt
+
+cat jenkins-plugins.txt | tr '\n' ',' >> default-jenkins-plugins.txt
\ No newline at end of file
diff --git a/c3iaas/jenkins-plugins.txt b/c3iaas/jenkins-plugins.txt
index 7ace28c..0414409 100644
--- a/c3iaas/jenkins-plugins.txt
+++ b/c3iaas/jenkins-plugins.txt
@@ -1,47 +1,6 @@
-openshift-login:latest\
-openshift-client:latest\
-openshift-sync:latest\
-kubernetes:latest\
-credentials:latest\
-docker-commons:latest\
-pipeline-model-definition:latest\
-lockable-resources:latest\
-config-file-provider:latest\
-htmlpublisher:latest\
-job-dsl:latest\
-mailer:latest\
-parameterized-trigger:latest\
-pipeline-build-step:latest\
-pipeline-input-step:latest\
-script-security:latest\
-ant:latest\
-pam-auth:latest\
-git-client:latest\
-credentials-binding:latest\
-junit:latest\
-workflow-support:latest\
-git:latest\
-mercurial:latest\
-subversion:latest\
-github:latest\
-github-branch-source:latest\
-workflow-cps:latest\
-workflow-cps-global-lib:latest\
-token-macro:latest\
-workflow-remote-loader:latest\
-mapdb-api:latest\
-matrix-project:latest\
-ssh-credentials:latest\
-pipeline-utility-steps:latest\
-pipeline-github-lib:latest\
-github-organization-folder:latest\
-matrix-auth:latest\
-blueocean:latest\
-workflow-aggregator:latest\
-metrics:latest\
-script-security:latest\
-permissive-script-security:latest\
-timestamper:latest\
-http_request:latest\
-antisamy-markup-formatter:latest\
+script-security:latest
+permissive-script-security:latest
+timestamper:latest
+http_request:latest
+antisamy-markup-formatter:latest
 update-sites-manager:latest

From 8e7927886fe06a85a45f15aef0a59a2ea1857eb3 Mon Sep 17 00:00:00 2001
From: Pavlina Bortlova <pbortlov@redhat.com>
Date: Mar 12 2020 15:50:52 +0000
Subject: [PATCH 3/3] Remove prometheus


---

diff --git a/c3iaas/get-all-jenkins-plugins.sh b/c3iaas/get-all-jenkins-plugins.sh
index 14e1804..f87a29f 100755
--- a/c3iaas/get-all-jenkins-plugins.sh
+++ b/c3iaas/get-all-jenkins-plugins.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
 
-curl https://raw.githubusercontent.com/openshift/jenkins/master/2/contrib/openshift/base-plugins.txt | grep -vE "(#|prometheus)" |grep -v '^$' | sed 's/:.*/:latest/'| tr '\n' ',' > default-jenkins-plugins.txt
+curl https://raw.githubusercontent.com/openshift/jenkins/master/2/contrib/openshift/base-plugins.txt | grep -v "#" |grep -v '^$' | sed 's/:.*/:latest/'| tr '\n' ',' > default-jenkins-plugins.txt
 
-cat jenkins-plugins.txt | tr '\n' ',' >> default-jenkins-plugins.txt
\ No newline at end of file
+cat jenkins-plugins.txt | tr '\n' ',' >> default-jenkins-plugins.txt

