diff options
Diffstat (limited to 'cns-libs/templates')
10 files changed, 0 insertions, 439 deletions
diff --git a/cns-libs/templates/jenkins/README b/cns-libs/templates/jenkins/README deleted file mode 100644 index 1402a56f..00000000 --- a/cns-libs/templates/jenkins/README +++ /dev/null @@ -1,6 +0,0 @@ -============== -REFERENCES -============== - -Jenkins template and load script files are refered from the below github code: - https://github.com/openshift/svt/tree/master/storage/jenkins diff --git a/cns-libs/templates/jenkins/files/start-load-on-jenkins.j2 b/cns-libs/templates/jenkins/files/start-load-on-jenkins.j2 deleted file mode 100755 index 7c85e8bd..00000000 --- a/cns-libs/templates/jenkins/files/start-load-on-jenkins.j2 +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -readonly TOTAL_BUILD_NUMBER=29 -readonly JENKINS_URL=$(awk '/^url/{split ($1, a, "="); print a[2]}' /etc/jenkins_jobs/jenkins_jobs.ini) - -echo "JENKINS_URL: $JENKINS_URL" - -function trigger() { - local url - local job_name - - url=$1 - job_name=$2 - - echo "Start job: $job_name" - curl -s -k --user admin:password -X POST "${url}/job/${job_name}/build/api/json" --data-urlencode json='{"parameter": []}' -} - - -function check_build() { - local result - local job_name - local url - - url=$1 - job_name=$2 - - echo "Executing validation for job: ${job_name}" - result=$(curl -s -k --user admin:password ${url}/job/${job_name}/lastBuild/api/json | python -c "import json,sys; obj=json.load(sys.stdin); print obj['result'] if 'result' in obj else False") - - echo "Status: ${result}" - if [[ "${result}" = "SUCCESS" ]] || [[ "${result}" = "FAILURE" ]] || [[ "${result}" = "UNSTABLE" ]] || [[ "${result}" = "ABORTED" ]] - then - echo "Build completed, re-starting build" - trigger "${JENKINS_URL}" "${job_name}" - else - echo "Build in progress, waiting for completion" - fi -} - - -### delete jobs -echo "Delete existing jobs" -for j in $(seq 0 ${TOTAL_BUILD_NUMBER}) -do - jenkins-jobs delete test-${j}_job -done - -echo "Wait for 30 sec until all jobs get created" -sleep 30 - -### create jobs -echo "Create new jobs" -jenkins-jobs --flush-cache update --delete-old /data - -echo "Wait for 30 sec until all jobs get created" -sleep 30 - -### trigger jobs -echo "Start building new job" -for j in $(seq 0 ${TOTAL_BUILD_NUMBER}) -do - trigger "${JENKINS_URL}" "test-${j}_job" -done - -echo "Wait for 2 mins to jenkin schedule and start the jobs" -sleep 120 - -### check jobs -echo "Start polling status for started jobs" - -while true -do - for i in $(seq 0 ${TOTAL_BUILD_NUMBER}) - do - check_build "${JENKINS_URL}" "test-${i}_job/job/ttt" - done - - echo "Validated all jobs geting some rest" - sleep 30 -done diff --git a/cns-libs/templates/jenkins/groovy/install_jdk8.groovy b/cns-libs/templates/jenkins/groovy/install_jdk8.groovy deleted file mode 100644 index fb104cdb..00000000 --- a/cns-libs/templates/jenkins/groovy/install_jdk8.groovy +++ /dev/null @@ -1,23 +0,0 @@ -import jenkins.model.* -import hudson.model.* -import hudson.tools.* - -def inst = Jenkins.getInstance() - -def desc = inst.getDescriptor("hudson.model.JDK") - -def versions = [ - "jdk8": "jdk-8u172-oth-JPR" -] -def installations = []; - -for (v in versions) { - def installer = new JDKInstaller(v.value, true) - def installerProps = new InstallSourceProperty([installer]) - def installation = new JDK(v.key, "", [installerProps]) - installations.push(installation) -} - -desc.setInstallations(installations.toArray(new JDK[0])) - -desc.save() diff --git a/cns-libs/templates/jenkins/groovy/install_mvn339.groovy b/cns-libs/templates/jenkins/groovy/install_mvn339.groovy deleted file mode 100644 index 4776d240..00000000 --- a/cns-libs/templates/jenkins/groovy/install_mvn339.groovy +++ /dev/null @@ -1,19 +0,0 @@ -import hudson.tasks.Maven.MavenInstallation; -import hudson.tools.InstallSourceProperty; -import hudson.tools.ToolProperty; -import hudson.tools.ToolPropertyDescriptor; -import hudson.util.DescribableList; - -def mavenDesc = jenkins.model.Jenkins.instance.getExtensionList(hudson.tasks.Maven.DescriptorImpl.class)[0] - -def isp = new InstallSourceProperty() -def autoInstaller = new hudson.tasks.Maven.MavenInstaller("3.3.9") -isp.installers.add(autoInstaller) - -def proplist = new DescribableList<ToolProperty<?>, ToolPropertyDescriptor>() -proplist.add(isp) - -def installation = new MavenInstallation("Maven 3.3.9", "", proplist) - -mavenDesc.setInstallations(installation) -mavenDesc.save() diff --git a/cns-libs/templates/jenkins/groovy/jenkins_set_no_of_executor.groovy.j2 b/cns-libs/templates/jenkins/groovy/jenkins_set_no_of_executor.groovy.j2 deleted file mode 100644 index c2b36eb7..00000000 --- a/cns-libs/templates/jenkins/groovy/jenkins_set_no_of_executor.groovy.j2 +++ /dev/null @@ -1,5 +0,0 @@ -import jenkins.model.* -def instance = Jenkins.getInstance() - -// No jobs on master -instance.setNumExecutors(10) diff --git a/cns-libs/templates/jenkins/groovy/jenkins_setup_jdk_user.groovy.j2 b/cns-libs/templates/jenkins/groovy/jenkins_setup_jdk_user.groovy.j2 deleted file mode 100644 index 905eb1cb..00000000 --- a/cns-libs/templates/jenkins/groovy/jenkins_setup_jdk_user.groovy.j2 +++ /dev/null @@ -1,6 +0,0 @@ -import jenkins.model.* -import hudson.model.* - -def inst = Jenkins.getInstance() -def desc = inst.getDescriptor("hudson.tools.JDKInstaller") -println desc.doPostCredential('vsmahajan007@gmail.com','Test#123') diff --git a/cns-libs/templates/jenkins/jjb/defaults.yaml b/cns-libs/templates/jenkins/jjb/defaults.yaml deleted file mode 100644 index 6434856b..00000000 --- a/cns-libs/templates/jenkins/jjb/defaults.yaml +++ /dev/null @@ -1,2 +0,0 @@ -- defaults: - name: global diff --git a/cns-libs/templates/jenkins/jjb/job-template.yaml b/cns-libs/templates/jenkins/jjb/job-template.yaml deleted file mode 100644 index 1acab55b..00000000 --- a/cns-libs/templates/jenkins/jjb/job-template.yaml +++ /dev/null @@ -1,9 +0,0 @@ -- job-template: - name: '{name}_job' - description: 'job description' - project-type: multibranch - number-to-keep: 30 - days-to-keep: 30 - scm: - - git: - url: '{git_url}' diff --git a/cns-libs/templates/jenkins/templates/jenkins-persistent-template.yaml b/cns-libs/templates/jenkins/templates/jenkins-persistent-template.yaml deleted file mode 100644 index 78c89e7d..00000000 --- a/cns-libs/templates/jenkins/templates/jenkins-persistent-template.yaml +++ /dev/null @@ -1,218 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -labels: - app: jenkins-persistent - template: jenkins-persistent-template -message: A Jenkins service has been created in your project. Log into Jenkins with - your OpenShift account. The tutorial at https://github.com/openshift/origin/blob/master/examples/jenkins/README.md - contains more information about using this template. -metadata: - annotations: - description: |- - Jenkins service, with persistent storage. - - NOTE: You must have persistent volumes available in your cluster to use this template. - iconClass: icon-jenkins - openshift.io/display-name: Jenkins - openshift.io/documentation-url: https://docs.openshift.org/latest/using_images/other_images/jenkins.html - openshift.io/long-description: This template deploys a Jenkins server capable - of managing OpenShift Pipeline builds and supporting OpenShift-based oauth login. - openshift.io/provider-display-name: Red Hat, Inc. - openshift.io/support-url: https://access.redhat.com - tags: instant-app,jenkins - creationTimestamp: 2018-03-29T11:18:43Z - name: jenkins-persistent - namespace: openshift - resourceVersion: "898" - selfLink: /apis/template.openshift.io/v1/namespaces/openshift/templates/jenkins-persistent - uid: f0e942eb-3342-11e8-95ee-0202afd7e94a -objects: -- apiVersion: v1 - kind: Route - metadata: - annotations: - haproxy.router.openshift.io/timeout: 4m - template.openshift.io/expose-uri: http://{.spec.host}{.spec.path} - name: ${JENKINS_SERVICE_NAME} - spec: - tls: - insecureEdgeTerminationPolicy: Redirect - termination: edge - to: - kind: Service - name: ${JENKINS_SERVICE_NAME} -- apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: ${JENKINS_SERVICE_NAME} - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: ${VOLUME_CAPACITY} - storageClassName: ${STORAGE_CLASS_NAME} -- apiVersion: v1 - kind: DeploymentConfig - metadata: - annotations: - template.alpha.openshift.io/wait-for-ready: "true" - name: ${JENKINS_SERVICE_NAME} - spec: - replicas: 1 - selector: - name: ${JENKINS_SERVICE_NAME} - strategy: - type: Recreate - template: - metadata: - labels: - name: ${JENKINS_SERVICE_NAME} - spec: - containers: - - capabilities: {} - env: - - name: OPENSHIFT_ENABLE_OAUTH - value: ${ENABLE_OAUTH} - - name: OPENSHIFT_ENABLE_REDIRECT_PROMPT - value: "true" - - name: KUBERNETES_MASTER - value: https://kubernetes.default:443 - - name: KUBERNETES_TRUST_CERTIFICATES - value: "true" - - name: JENKINS_SERVICE_NAME - value: ${JENKINS_SERVICE_NAME} - - name: JNLP_SERVICE_NAME - value: ${JNLP_SERVICE_NAME} - image: ' ' - imagePullPolicy: IfNotPresent - livenessProbe: - failureThreshold: 2 - httpGet: - path: /login - port: 8080 - initialDelaySeconds: 420 - periodSeconds: 360 - timeoutSeconds: 240 - name: jenkins - readinessProbe: - httpGet: - path: /login - port: 8080 - initialDelaySeconds: 3 - timeoutSeconds: 240 - resources: - limits: - memory: ${MEMORY_LIMIT} - securityContext: - capabilities: {} - privileged: false - terminationMessagePath: /dev/termination-log - volumeMounts: - - mountPath: /var/lib/jenkins - name: ${JENKINS_SERVICE_NAME}-data - dnsPolicy: ClusterFirst - restartPolicy: Always - serviceAccountName: ${JENKINS_SERVICE_NAME} - volumes: - - name: ${JENKINS_SERVICE_NAME}-data - persistentVolumeClaim: - claimName: ${JENKINS_SERVICE_NAME} - triggers: - - imageChangeParams: - automatic: true - containerNames: - - jenkins - from: - kind: ImageStreamTag - name: ${JENKINS_IMAGE_STREAM_TAG} - namespace: ${NAMESPACE} - lastTriggeredImage: "" - type: ImageChange - - type: ConfigChange -- apiVersion: v1 - kind: ServiceAccount - metadata: - annotations: - serviceaccounts.openshift.io/oauth-redirectreference.jenkins: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"${JENKINS_SERVICE_NAME}"}}' - name: ${JENKINS_SERVICE_NAME} -- apiVersion: v1 - groupNames: null - kind: RoleBinding - metadata: - name: ${JENKINS_SERVICE_NAME}_edit - roleRef: - name: edit - subjects: - - kind: ServiceAccount - name: ${JENKINS_SERVICE_NAME} -- apiVersion: v1 - kind: Service - metadata: - name: ${JNLP_SERVICE_NAME} - spec: - ports: - - name: agent - nodePort: 0 - port: 50000 - protocol: TCP - targetPort: 50000 - selector: - name: ${JENKINS_SERVICE_NAME} - sessionAffinity: None - type: ClusterIP -- apiVersion: v1 - kind: Service - metadata: - annotations: - service.alpha.openshift.io/dependencies: '[{"name": "${JNLP_SERVICE_NAME}", - "namespace": "", "kind": "Service"}]' - service.openshift.io/infrastructure: "true" - name: ${JENKINS_SERVICE_NAME} - spec: - ports: - - name: web - nodePort: 0 - port: 80 - protocol: TCP - targetPort: 8080 - selector: - name: ${JENKINS_SERVICE_NAME} - sessionAffinity: None - type: ClusterIP -parameters: -- description: The name of the OpenShift Service exposed for the Jenkins container. - displayName: Jenkins Service Name - name: JENKINS_SERVICE_NAME - value: jenkins -- description: The name of the service used for master/slave communication. - displayName: Jenkins JNLP Service Name - name: JNLP_SERVICE_NAME - value: jenkins-jnlp -- description: Whether to enable OAuth OpenShift integration. If false, the static - account 'admin' will be initialized with the password 'password'. - displayName: Enable OAuth in Jenkins - name: ENABLE_OAUTH - value: "true" -- description: Maximum amount of memory the container can use. - displayName: Memory Limit - name: MEMORY_LIMIT - value: 512Mi -- description: Volume space available for data, e.g. 512Mi, 2Gi. - displayName: Volume Capacity - name: VOLUME_CAPACITY - required: true - value: 1Gi -- description: The OpenShift Namespace where the Jenkins ImageStream resides. - displayName: Jenkins ImageStream Namespace - name: NAMESPACE - value: openshift -- description: Name of the ImageStreamTag to be used for the Jenkins image. - displayName: Jenkins ImageStreamTag - name: JENKINS_IMAGE_STREAM_TAG - value: jenkins:2 -- description: Storage Class Name of PVC. - displayName: Storage Class Name - name: STORAGE_CLASS_NAME - required: true - value: "gp2" diff --git a/cns-libs/templates/jenkins/templates/jjb-template.yaml b/cns-libs/templates/jenkins/templates/jjb-template.yaml deleted file mode 100644 index c26019b1..00000000 --- a/cns-libs/templates/jenkins/templates/jjb-template.yaml +++ /dev/null @@ -1,70 +0,0 @@ -apiVersion: v1 -kind: Template -metadata: - creationTimestamp: null - name: config_map_jjb -objects: -- apiVersion: v1 - data: - jenkins_jobs.ini: | - [jenkins] - user=${JENKINS_USER} - password=${JENKINS_PASSWORD} - url=${JENKINS_URL} - query_plugins_info=False - kind: ConfigMap - metadata: - creationTimestamp: null - name: ${JJB_SERVICE_NAME} -- kind: "DeploymentConfig" - apiVersion: "v1" - metadata: - name: ${JJB_SERVICE_NAME} - spec: - template: - metadata: - labels: - name: ${JJB_SERVICE_NAME} - spec: - containers: - - name: ${JJB_SERVICE_NAME} - image: "docker.io/hongkailiu/jjb:2.0.6" - env: - - name: PYTHONHTTPSVERIFY - value: "0" - - name: XDG_CACHE_HOME - value: "/data" - volumeMounts: - - name: config-volume - mountPath: /etc/jenkins_jobs/ - - name: "data-vol" - mountPath: "/data" - volumes: - - name: config-volume - configMap: - name: ${JJB_SERVICE_NAME} - - name: "data-vol" - emptyDir: {} - triggers: - - type: "ConfigChange" - replicas: 1 -parameters: -- description: Jenkins User - displayName: Jenkins User - name: JENKINS_USER - required: true - value: admin -- description: Jenkins Password - displayName: Jenkins Password - name: JENKINS_PASSWORD - required: true - value: password -- description: Jenkins URL, eg, https://jenkins-ttt.apps.0327-nbn.qe.rhcloud.com - displayName: Jenkins URL - name: JENKINS_URL - required: true -- description: JJB Service Name - displayName: JJB Service Name - name: JJB_SERVICE_NAME - required: true - value: "jjb" |