siamaksade / openshift-jenkins-demo Goto Github PK
View Code? Open in Web Editor NEWCI/CD Demo on OpenShift
Home Page: http://www.openshift.com
CI/CD Demo on OpenShift
Home Page: http://www.openshift.com
oc policy add-role-to-group system:image-puller system:serviceaccounts:stage -n dev
Without the above the stage project is unable to pull image from dev
Hi all,
tried the demo (after trying for several days to get coolstore-microservices running) and it gave me some valuable reproducible results:
Basically that's enought and efficient for my task of creating a full offline demo.
There were some glitches when I tried following the demo, though. To make it more reproducible:
$ oc version
oc v3.4.1.10
kubernetes v1.4.0+776c994
features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://127.0.0.1:8443
openshift v3.4.1.10
kubernetes v1.4.0+776c994
Used oc-cluster-wrapper to get the local cluster up
$ oc-cluster show
# Using client for ocp v3.4.1.10
oc cluster up --version v3.4.1.10 --image registry.access.redhat.com/openshift3/ose --public-hostname 127.0.0.1 --routing-suffix apps.127.0.0.1.nip.io --host-data-dir /home/mydir/.oc/profiles/base127xpaas/data --host-config-dir /home/mydir/.oc/profiles/base127xpaas/config --use-existing-config -e TZ=CEST
i.e. started the cluster and processed the template with:
oc-cluster up base127xpaas --image="registry.access.redhat.com/openshift3/ose" --version=v3.4.1.10
oc login -u system:admin
oc project default
oc adm policy add-cluster-role-to-user cluster-admin developer
oc adm policy add-cluster-role-to-user cluster-admin admin
# cd => git clone dir
git clone https://github.com/OpenShiftDemos/openshift-cd-demo
cd openshift-cd-demo
oc new-project dev --display-name="Tasks - Dev"
oc new-project stage --display-name="Tasks - Stage"
oc new-project cicd --display-name="CI/CD"
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n dev
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n stage
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n cicd
oc process -f cicd-template.yaml -v DEV_PROJECT=dev -v STAGE_PROJECT=stage | oc create -f - -n cicd
Unfortunately, the install-gogs pod did not run successfully, see attached file 2017-03-30_gogs_install_failure.txt, and exited with 255. Therefor - it seems to me - the demo repository has not been cloned to the local gogs.
Retrying as per the documentation with
$ oc delete pod install-gogs
$ oc delete pods -l app=gogs
$ oc process -f cicd-template.yaml | oc create -f
gave the same result, log available as attached file 2017-03-30_gogs_install_failure_2nd_try.txt.
Here b.t.w. the output differs from the documentation:
$ oc process -f cicd-template.yaml | oc create -f -
pod "install-gogs" created
Error from server: buildconfigs "tasks-pipeline" already exists
Error from server: routes "jenkins" already exists
Error from server: deploymentconfigs "jenkins" already exists
Error from server: rolebinding "default_edit" already exists
Error from server: services "jenkins-jnlp" already exists
Error from server: services "jenkins" already exists
Error from server: services "nexus" already exists
Error from server: routes "nexus" already exists
Error from server: imagestreams "nexus" already exists
Error from server: deploymentconfigs "nexus" already exists
Error from server: services "gogs" already exists
Error from server: services "postgresql-gogs" already exists
Error from server: routes "gogs" already exists
Error from server: imagestreams "gogs" already exists
Error from server: deploymentconfigs "gogs" already exists
Error from server: deploymentconfigs "postgresql-gogs" already exists
Error from server: configmaps "gogs-install" already exists
Error from server: services "postgresql-sonarqube" already exists
Error from server: services "sonarqube" already exists
Error from server: routes "sonarqube" already exists
Error from server: imagestreams "sonarqube" already exists
Error from server: deploymentconfigs "postgresql-sonarqube" already exists
Error from server: deploymentconfigs "sonarqube" already exists
I think it'd be great if either the documentation and install-gogs could be changed or at least a clear statement be made that this project is abandoned.
Best wishes,
Karsten
Hi,
I'm deploying this to Openshift 3.2 but when I run the Jenkins build the console print out is
Started by user anonymous
[Pipeline] Allocate node : Start
Still waiting to schedule task
Waiting for next available executor
the output of oc get node -o wide is
cicd jdk-jenkins-slave-1-build 1/1 Running 0 9m node2.example.com
cicd jenkins-1-build 1/1 Running 0 9m node1.example.com
cicd nexus-1-kkesy 1/1 Running 0 9m node1.example.com
cicd postgresql-sonarqube-1-tgr7l 1/1 Running 0 9m node2.example.com
cicd sonarqube-1-g7i0o 1/1 Running 0 9m node1.example.com
And I have executed:
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n cicd
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n dev
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n stage
The openshift install is multi-tenanted so I have executed
os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant'
As on an alternative build pipeline demo readiness checks were executed by Jenkins requiring communication from the Jenkins namespace to the application name spaces.
Any ideas appreciated.
Peter.
pHello guys!
I'm having this issue while trying to execute my pipeline, any idea?
OpenShift Build tasks-pipeline13
[Pipeline] node
Still waiting to schedule task
All nodes of label ‘nodejs’ are offline
Running on nodejs-69e36c499aac1 in /tmp/workspace
[Pipeline] {
[Pipeline] sh
[cicd] Running shell script
Hi all,
I have tried to switch from ephemeral jenkins to persistent jenkins. For this, I modified the jenkins-persistent template in de openshift project to point to a PersistentVolumeClaim backed by heketi. I also added the following configuration at the bottom of my master-config as instructed in the documentation to override the default template to be used for a BuildConfig type JenkinsPipeline.
jenkinsPipelineConfig:
autoProvisionEnabled: true
templateNamespace: openshift
templateName: jenkins-persistent
serviceName: jenkins
My modified template looks like the following (adding storageClassName: heketi):
apiVersion: template.openshift.io/v1
kind: Template
labels:
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 (Persistent)
tags: 'instant-app,jenkins'
template.openshift.io/documentation-url: 'https://docs.openshift.org/latest/using_images/other_images/jenkins.html'
template.openshift.io/long-description: >-
This template deploys a Jenkins server capable of managing OpenShift
Pipeline builds and supporting OpenShift-based oauth login.
template.openshift.io/provider-display-name: 'Red Hat, Inc.'
template.openshift.io/support-url: 'https://access.redhat.com'
creationTimestamp: '2017-10-19T10:55:00Z'
name: jenkins-persistent
namespace: openshift
resourceVersion: '103975'
selfLink: >-
/apis/template.openshift.io/v1/namespaces/openshift/templates/jenkins-persistent
uid: f44bb359-b4bb-11e7-b702-00505683db64
objects:
- apiVersion: v1
kind: Route
metadata:
annotations:
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: heketi
- 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: OPENSHIFT_JENKINS_JVM_ARCH
value: '${JVM_ARCH}'
- name: KUBERNETES_MASTER
value: 'https://kubernetes.default:443'
- name: KUBERNETES_TRUST_CERTIFICATES
value: 'true'
- name: JNLP_SERVICE_NAME
value: '${JNLP_SERVICE_NAME}'
image: ' '
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 30
httpGet:
path: /login
port: 8080
initialDelaySeconds: 420
timeoutSeconds: 3
name: jenkins
readinessProbe:
httpGet:
path: /login
port: 8080
initialDelaySeconds: 3
timeoutSeconds: 3
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: Whether Jenkins runs with a 32 bit (i386) or 64 bit (x86_64) JVM.
displayName: Jenkins JVM Architecture
name: JVM_ARCH
value: i386
- 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:latest'
However... the jenkins POD's never show up and somehow seem never to get trigger to do so as well. I am quite sure heketi is working because I also modified all persistentVolumeClaim's in this demo to heketi and that works well.
Any idea on how to debug this or where to start this demo with persistent storage for jenkins?
Best regards,
Bart
The pipeline execution fails with:
Started by user anonymous
org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException: script not yet approved for use
at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:398)
at org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition.create(CpsFlowDefinition.java:116)
at org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition.create(CpsFlowDefinition.java:69)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:206)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
The pipeline script needs to get pre-approved to avoid this. The workaround is to edit and save the job once.
see above
Hi,
The projects are hard coded into the deployer, so if 2 users want to deploy the demo on the same cluster they can't.
Can we make a change to allow selecting your own project names?
Thanks,
[Pipeline] stage (Deploy DEV)
Entering stage Deploy DEV
Proceeding
[Pipeline] sh
[tasks-cd-pipeline] Running shell script
[tasks-cd-pipeline] Running shell script
No resources found
[Pipeline] sh
[tasks-cd-pipeline] Running shell script
++ cat /var/run/secrets/kubernetes.io/serviceaccount/token
error: no match for "jboss-eap64-openshift"
The 'oc new-build' command will match arguments to the following types:
--allow-missing-images can be used to force the use of an image that was not matched
See 'oc new-build -h' for examples.
Hi,
I used cicd-template-with-sonar.yaml to bring up my CI/CD Environment...
But Gogs is not getting Installed properly..
Unable to Open Gogs...When trying to Open Gogs we are getting page as below:
postgresql-gogs : container is getting into Crashloopbackoff state...
Error in the postgresql-gogs pod is as follows:
--> Scaling postgresql-gogs-1 to 1
--> Waiting up to 10m0s for pods in rc postgresql-gogs-1 to become ready
error: update acceptor rejected postgresql-gogs-1: pods for rc "postgresql-gogs-1" took longer than 600 seconds to become ready
How will this Isuue gets resolved??
when tried login with openshift orgin credentials system-admin
ERROR: "system" is prohibited as a full name for security reasons. occurs
or says missing overall read permission. what are the credentials that I should use to login into jenkins??
Everytime I do a oc cluster down and then up again (I have host-data-dir configured) , Gogs goes back to the installation screen.
This loses all repository history even if pointed again to the gogs-postfreqsl pod (gives a 500 error at that point to the repo)
I've loaded both templates several times and sometimes everything works as a charm, but other times I get an ImagePullBackoff due to the image in the spec.template.spec of the deploymentconfig of nexus is " ". I've read the openshift and kubernetes doc but nothing is showing the use of an empty image string. Why is this used here with wat goal in mind?
Hi
I am getting this all the time
[Static Analysis] /opt/rh/rh-maven33/root/usr/bin/mvn: line 9: 298 Killed
Any idea how else to fix it?
Thanks
-Codrin
either trigger from Jenkins or from oc build, the pipeline tasks are queued up but none would start running on Jenkins.
The build jobs are stuck at "No stages have started."
Hi all,
I'm running the demo on Minishift using Origin 3.6 branch, the cluster builds correctly but the pipleline maven execution fails on missing cicd-settings.xml that is defined on line 95 as follow:
def mvnCmd = "mvn -s configuration/cicd-settings.xml"
Where is the file configuration/cicd-settings.xml should be added so it can be found by the jnlp maven dynamic pod at runtime?
Thanks!
-Hany
Use ConfigMap to mount custom database configuration to custom/conf/app.ini so that Gogs is pre-configured when template is instantiated.
Could this work for the slave?
https://hub.docker.com/r/thoraxe/jdk8-maven/
I don't have a problem with building everything off CentOS for the demos. We can't push the demo content to Docker Hub if it has RHEL anyway.
Could we have the possibilty of triggering the deployment of (i.e.) Nexus after the deployment of (i.e.) Gogs is completed?
Is it a good idea to profit the machine's resources in a better way?
Thanks a lot in advance.
After oc policy add...
and oc project cicd
I ran the following:
oc process -f https://raw.githubusercontent.com/OpenShiftDemos/openshift-cd-demo/openshift-3.3/cicd-template.yaml | oc create -f -
and received the error:
Error from server: unrecognized build strategy: api.BuildStrategy{DockerStrategy:(*api.DockerBuildStrategy)(nil), SourceStrategy:(*api.SourceBuildStrategy)(nil), CustomStrategy:(*api.CustomBuildStrategy)(nil)}
I have got following error message, however there is no description about buildconfigs "tasks".
How can I fix it?
Uploading "oc-build" at commit "HEAD" as binary input for the build ...
Uploading directory "oc-build" as binary input for the build ...
Error from server: buildconfigs "tasks" not found
[Pipeline] } //node
[Pipeline] Allocate node : End
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
Thanks
Jim
Hi . Thanks for your contribution .
I want to use this repository with http-proxy .
There are some points will need to be fixed , I think .
Brunch : ocp-3.5 ( .. that I use )
gogs's deployment config needs HTTP_PROXY, HTTPS_PROXY
Line:405 in cicd-template-with-sonar.yaml
Line:329 in cicd-template.yaml
NEXUS's http proxy setting . ( I only know how to change that setting from the WebUI.)
Current version(Brunch: ocp-3.5) has some bugs
-.1 Pipeline should need to be fixed in cicd-template-with-sonar.yaml
--image-stream=jboss-eap70-openshift
|
--image-stream=jboss-eap70-openshift:1.5
-.2 gogs's deployment config needs to be fixed in cicd-template-with-sonar.yaml
- name: gogs-custom-config
mountPath: /etc/gogs/conf
- name: gogs-custom-config
mountPath: /opt/gogs/custom/conf
Please consider it including the correction point.
Regards,
toaraki
I've tried both templates (github and gogs) to setup the cicd environment. Unfortunately the nexus and sonarqube services fail as the deployments fail. The nexus deployment comes with the following log:
I0805 07:18:29.020785 1 deployer.go:200] Deploying cicd/nexus-4 for the first time (replicas: 1) I0805 07:18:29.024570 1 recreate.go:126] Scaling cicd/nexus-4 to 1 before performing acceptance check I0805 07:18:31.057037 1 recreate.go:131] Performing acceptance check of cicd/nexus-4 I0805 07:18:31.057124 1 lifecycle.go:445] Waiting 600 seconds for pods owned by deployment "cicd/nexus-4" to become ready (checking every 1 seconds; 0 pods previously accepted) F0805 07:28:31.057644 1 deployer.go:70] update acceptor rejected cicd/nexus-4: pods for deployment "cicd/nexus-4" took longer than 600 seconds to become ready
and the sonarqube comes with:
I0805 07:26:12.470246 1 deployer.go:200] Deploying cicd/sonarqube-3 for the first time (replicas: 1) I0805 07:26:12.475621 1 recreate.go:126] Scaling cicd/sonarqube-3 to 1 before performing acceptance check I0805 07:26:14.530304 1 recreate.go:131] Performing acceptance check of cicd/sonarqube-3 I0805 07:26:14.530378 1 lifecycle.go:445] Waiting 600 seconds for pods owned by deployment "cicd/sonarqube-3" to become ready (checking every 1 seconds; 0 pods previously accepted) F0805 07:36:14.530993 1 deployer.go:70] update acceptor rejected cicd/sonarqube-3: pods for deployment "cicd/sonarqube-3" took longer than 600 seconds to become ready
oc get pods shows
jdk-jenkins-slave-1-build 0/1 Completed 0 2h jenkins-1-build 0/1 Completed 0 2h jenkins-1-wv5b0 1/1 Running 0 2h nexus-1-deploy 0/1 DeadlineExceeded 0 2h nexus-2-deploy 0/1 DeadlineExceeded 0 2h nexus-3-deploy 0/1 DeadlineExceeded 0 2h nexus-4-deploy 0/1 Error 0 35m postgresql-sonarqube-1-2oe3z 1/1 Running 0 2h sonarqube-1-deploy 0/1 DeadlineExceeded 0 2h sonarqube-2-deploy 0/1 Error 0 2h sonarqube-3-deploy 0/1 Error 0 27m
any idea why this doesn't work?
Hi,
Do you know if your demo works with an internal proxy to access to the internet ?
Currently, when I'm trying to run the build from Jenkins, the console output is just
Started by user anonymous
[Pipeline] Allocate node : Start
Still waiting to schedule task
Waiting for next available executor
No slave pod is created on my OpenShift project
So, I had a look to the Jenkins pod logs, and every ten seconds during the build, the following error is triggered :
Sep 09, 2016 3:15:54 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud provision
INFO: Excess workload after pending Spot instances: 1
Sep 09, 2016 3:15:54 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud provision
WARNING: Failed to count the # of live instances on Kubernetes
java.lang.IllegalArgumentException: No enum constant com.ning.http.client.ProxyServer.Protocol.http
at java.lang.Enum.valueOf(Enum.java:238)
at com.ning.http.client.ProxyServer$Protocol.valueOf(ProxyServer.java:33)
at io.fabric8.kubernetes.client.BaseClient.createHttpClient(BaseClient.java:152)
at io.fabric8.kubernetes.client.BaseClient.<init>(BaseClient.java:68)
at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:89)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesFactoryAdapter.createClient(KubernetesFactoryAdapter.java:71)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.connect(KubernetesCloud.java:197)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.addProvisionedSlave(KubernetesCloud.java:415)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.provision(KubernetesCloud.java:297)
at hudson.slaves.NodeProvisioner$StandardStrategyImpl.apply(NodeProvisioner.java:700)
at hudson.slaves.NodeProvisioner.update(NodeProvisioner.java:305)
at hudson.slaves.NodeProvisioner.access$000(NodeProvisioner.java:58)
at hudson.slaves.NodeProvisioner$NodeProvisionerInvoker.doRun(NodeProvisioner.java:797)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:50)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I tried to figure out how to set a proxy on Jenkins, unfortunately nothing worked at the moment.
Do you have an idea ?
Thank you
Best regards,
Cyril
Hi,
I want to put use my NodeJS code..
For that how can I deploy Nodejs slave...so that I can run any Nodejs commnads...
How to put Nodejs related configuration into cicd-template.yaml???
I have finished install nexus, sonarQ,jenkins and gogs on OCP 3.5.
Tasks example project was cloned in gogs server.
All seems working fine, but when tasks-pipeline is executed, next error it's shown:
`Cloning the remote Git repository
Cloning repository http://gogs:3000/gogs/openshift-tasks.git
Resolving deltas: 100% (188/188) Resolving deltas: 100% (188/188), done.git init /tmp/workspace/task-cicd-tasks-pipeline # timeout=10
Fetching upstream changes from http://gogs:3000/gogs/openshift-tasks.git
git --version # timeout=10
git fetch --tags --progress http://gogs:3000/gogs/openshift-tasks.git +refs/heads/:refs/remotes/origin/
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress http://gogs:3000/gogs/openshift-tasks.git +refs/heads/:refs/remotes/origin/" returned status code 128:
stdout:
stderr: remote: Counting objects: 588, done.
remote: Compressing objects: 0% (1/306)
fatal: unable to look up current user in the passwd file: no such user
Unexpected end of command stream
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at hudson.remoting.Engine$1$1.run(Engine.java:94)
at java.lang.Thread.run(Thread.java:748)
at ......remote call to Channel to /10.130.2.1(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1537)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
at hudson.remoting.Channel.call(Channel.java:822)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
at com.sun.proxy.$Proxy108.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1057)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:221)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: null
Finished: FAILURE`
if a manual git clone is done, it seems that all its working fine.
oc v3.5.5.31
kubernetes v1.5.2+43a9be4
features: Basic-Auth GSSAPI Kerberos SPNEGO
Gogs Version: 0.11.6.0407
Jenkins ver. 2.32.2
Hi all,
going further through the project I recognized that after committing and pushing the changed org.jboss.as.quickstarts.tasksrs.service.UserResourceTest.java from the eap-7 branch, no build is created as described in the documentation.
I also could not find any SCM related configuration in the Jenkins config and - of course not - in the dev and stage projects.
Could you perhaps please either change the documentation or the configuration accordingly?
Regards,
Karsten
Error shown below after executing oc process:
Error from server: buildconfigs "tasks-pipeline" is forbidden: unrecognized build strategy: api.BuildStrategy{DockerStrategy:(*api.DockerBuildStrategy)(nil), SourceStrategy:(*api.SourceBuildStrategy)(nil), CustomStrategy:(*api.CustomBuildStrategy)(nil), JenkinsPipelineStrategy:(*api.JenkinsPipelineBuildStrategy)(nil)}
For some reason the pipeline does not work initially. I had to do a tasks-cd-pipeline > configure > save (without making any changes) and it worked.
Instruction doesn't contain a link to openshift-tasks repo.
There is already a user gogs defined in Gogs, but what is the password?
The user admin with password gogs is not working.
HI
Main branch does not exist and is still referenced in yaml file.
Thanks
Hi all,
tried to follow the setup as described here and followed Siamak's videos at http://www.sonatype.org/nexus/2017/02/15/cicd-with-openshift/ but had no luck so far.
Setup on latest macOS with oc-cluster wrapper, i.e. startup command is
>$ occ show
# Using client for ocp v3.4.1.10
oc cluster up --version v3.4.1.10 --image registry.access.redhat.com/openshift3/ose --public-hostname 127.0.0.1 --routing-suffix apps.127.0.0.1.nip.io --host-data-dir /Users/myusername/.oc/profiles/cicd2day/data --host-config-dir /Users/myusername/.oc/profiles/cicd2day/config --use-existing-config -e TZ=CEST
Or - step-by-step:
oc-cluster up _PROFILENAME_ --image="registry.access.redhat.com/openshift3/ose" --version=v3.4.1.10
oc login -u system:admin
oc project default
oc adm policy add-cluster-role-to-user cluster-admin developer
oc adm policy add-cluster-role-to-user cluster-admin admin
git clone https://github.com/OpenShiftDemos/openshift-cd-demo
cd openshift-cd-demo
Admin permissions as above!
oc login -u developer
oc new-project dev --display-name="Tasks - Dev"
oc new-project stage --display-name="Tasks - Stage"
oc new-project cicd --display-name="CI/CD"
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n dev
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n stage
oc policy add-role-to-user edit system:serviceaccount:cicd:default -n cicd
oc process -f cicd-template.yaml -v DEV_PROJECT=dev -v STAGE_PROJECT=stage | oc create -f - -n cicd
This finally brought the cicd project successfully up (with the exception of the install-gogs pod, see the separate issue at #45 ). I.e. all gogs, Nexus, SonarQube running and accessible.
What I did now was "migrating" the openshift-tasks repository to the local gogs installation as install-gogs failed and there was no repository available.
Then I opened Jenkins, checked the pipeline script of the cicd/tasks-pipeline which was
node('maven') {
// define commands
def mvnCmd = "mvn -s configuration/cicd-settings.xml"
stage 'Build'
git branch: 'eap-7', url: 'http://gogs:3000/gogs/openshift-tasks.git'
def v = version()
sh "${mvnCmd} clean install -DskipTests=true"
stage 'Test and Analysis'
parallel (
'Test': {
sh "${mvnCmd} test"
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
},
'Static Analysis': {
sh "${mvnCmd} jacoco:report sonar:sonar -Dsonar.host.url=http://sonarqube:9000 -DskipTests=true"
}
)
stage 'Push to Nexus'
sh "${mvnCmd} deploy -DskipTests=true"
stage 'Deploy DEV'
sh "rm -rf oc-build && mkdir -p oc-build/deployments"
sh "cp target/openshift-tasks.war oc-build/deployments/ROOT.war"
// clean up. keep the image stream
sh "oc project ${DEV_PROJECT}"
sh "oc delete bc,dc,svc,route -l app=tasks -n ${DEV_PROJECT}"
// create build. override the exit code since it complains about exising imagestream
sh "oc new-build --name=tasks --image-stream=jboss-eap70-openshift --binary=true --labels=app=tasks -n ${DEV_PROJECT} || true"
// build image
sh "oc start-build tasks --from-dir=oc-build --wait=true -n ${DEV_PROJECT}"
// deploy image
sh "oc new-app tasks:latest -n ${DEV_PROJECT}"
sh "oc expose svc/tasks -n ${DEV_PROJECT}"
stage 'Deploy STAGE'
input message: "Promote to STAGE?", ok: "Promote"
sh "oc project ${STAGE_PROJECT}"
// tag for stage
sh "oc tag ${DEV_PROJECT}/tasks:latest ${STAGE_PROJECT}/tasks:${v}"
// clean up. keep the imagestream
sh "oc delete bc,dc,svc,route -l app=tasks -n ${STAGE_PROJECT}"
// deploy stage image
sh "oc new-app tasks:${v} -n ${STAGE_PROJECT}"
sh "oc expose svc/tasks -n ${STAGE_PROJECT}"
}
def version() {
def matcher = readFile('pom.xml') =~ '<version>(.+)</version>'
matcher ? matcher[0][1] : null
}
like in the template and didn't need further adjustments as shown in the video.
I ran the pipeline and it went up to the Nexus deployment successfully by deploying a jboss-tasks-rs-7.0.0-20170404.142030-2.war artifact (amongst others).
Then the Deploy DEV fails with:
[Pipeline] stage (Deploy DEV)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Deploy DEV
Proceeding
[Pipeline] sh
[cicd-tasks-pipeline] Running shell script
+ rm -rf oc-build
+ mkdir -p oc-build/deployments
[Pipeline] sh
[cicd-tasks-pipeline] Running shell script
+ cp target/openshift-tasks.war oc-build/deployments/ROOT.war
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: DEV_PROJECT for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:24)
at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
at WorkflowScript.run(WorkflowScript:28)
at ___cps.transform___(Native Method)
at (...)
Finished: FAILURE
One observation: I assume the artifact for deployment is not taken from Nexus (as single source of truth) but from the local Jenkins dir to reduce demo complexity, right?
Now my question: what do I need to do to get DEV_PROJECT resolved? Seems that using it in the oc process creation command is not sufficient?
Any troubleshooting advice?
Thanks and best wishes,
Karsten
Hi,
I'm using OCP V5. When I try to use the provided template for OCP 5 it fails.
Below is my command and the ouput.
oc process -f cicd-template.yaml | oc create -f -
error: yaml: line 308: mapping values are not allowed in this context
Regards
Not sure is an issue, or is due to a failed installation somewhere, but in local setups (cdk on OCP 3.3 and "oc cluster up" on OCP 3.4), the "-n" option seems not working on the jenkins pipeline (e.g. in "oc new-build --name=tasks --image-stream=jboss-eap70-openshift --binary=true --labels=app=tasks -n dev").
As a result, the task app is instantiated in "CICD" project, and the move to STAGE fails.
As a workaround, I've had to edit the pipeline, and explicitly change the project ("oc project dev" before the new build of tasks). Moreover, I've had to explicitly authorize "system:serviceaccount:cicd:jenkins" to edit in dev and stage projects.
Hope this help
Gogs needed to be installed when running for first time. I had to change the database to postgresql, update the IP address, and add the generated username and password.
I had to run the following command on the gogs postgresql pod to find the generated username and password for initial install:
oc describe pod
Hi,
I used cicd-template-with-sonar.yaml template to bring up the CICD setup...
Now all the tools are up and running..I created a pipeline of the following syntax:
node('mvn') {
// define commands
// def mvnCmd = "mvn -s configuration/cicd-settings.xml"
stage ('Build') {
git branch: 'eap-7', url: 'https://github.com/OpenShiftDemos/openshift-tasks.git'
sh "mvn clean install -DskipTests=true"
}
}
I am getting below Error:
OpenShift Build matcicd/tasks-pipeline-4
[Pipeline] node
Still waiting to schedule task
mvn-e67d6a067bf63 is offline
Running on mvn-e67d6a067bf63 in /tmp/workspace/matcicd-tasks-pipeline
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] git
Cloning the remote Git repository
Cloning repository https://github.com/OpenShiftDemos/openshift-tasks.git
git init /tmp/workspace/matcicd-tasks-pipeline # timeout=10
Fetching upstream changes from https://github.com/OpenShiftDemos/openshift-tasks.git
git --version # timeout=10
git fetch --tags --progress https://github.com/OpenShiftDemos/openshift-tasks.git +refs/heads/:refs/remotes/origin/
git config remote.origin.url https://github.com/OpenShiftDemos/openshift-tasks.git # timeout=10
git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
git config remote.origin.url https://github.com/OpenShiftDemos/openshift-tasks.git # timeout=10
Fetching upstream changes from https://github.com/OpenShiftDemos/openshift-tasks.git
git fetch --tags --progress https://github.com/OpenShiftDemos/openshift-tasks.git +refs/heads/:refs/remotes/origin/
git rev-parse refs/remotes/origin/eap-7^{commit} # timeout=10
git rev-parse refs/remotes/origin/origin/eap-7^{commit} # timeout=10
Checking out Revision 06dd2a4f1efc4b75a09928904dc91d90b32010ad (refs/remotes/origin/eap-7)
git config core.sparsecheckout # timeout=10
git checkout -f 06dd2a4f1efc4b75a09928904dc91d90b32010ad
git branch -a -v --no-abbrev # timeout=10
git checkout -b eap-7 06dd2a4f1efc4b75a09928904dc91d90b32010ad
git rev-list 06dd2a4f1efc4b75a09928904dc91d90b32010ad # timeout=10
[Pipeline] sh
[matcicd-tasks-pipeline] Running shell script
What could be the reason for this Error???Should some other configuration needs to be done???
I am using the v1.3.3 origin binary to run my openshift on CentOS7.
Upon running "oc process -f ./cicd-template.yaml | oc create -f -", jenkins and sonarqube failed to start. Same after manually re-deployed the applications (applications log stuck at "waiting upto 10m...")
origin log shows:
E0119 20:51:41.036547 5180 pod_workers.go:183] Error syncing pod a02d8c2b-decb-11e6-90ec-0800276fa492, skipping: failed to "StartContainer" for "postgresql" with ImagePullBackOff: "Back-off pulling image " ""
I0119 20:51:42.775627 5180 reconciler.go:294] MountVolume operation started for volume "kubernetes.io/secret/1d9ad6dc-dec9-11e6-90ec-0800276fa492-default-token-ppiyi" (spec.Name: "default-token-ppiyi") to pod "1d9ad6dc-dec9-11e6-90ec-0800276fa492" (UID: "1d9ad6dc-dec9-11e6-90ec-0800276fa492"). Volume is already mounted to pod, but remount was requested.
I0119 20:51:42.778152 5180 operation_executor.go:749] MountVolume.SetUp succeeded for volume "kubernetes.io/secret/1d9ad6dc-dec9-11e6-90ec-0800276fa492-default-token-ppiyi" (spec.Name: "default-token-ppiyi") pod "1d9ad6dc-dec9-11e6-90ec-0800276fa492" (UID: "1d9ad6dc-dec9-11e6-90ec-0800276fa492").
I0119 20:51:48.749131 5180 reconciler.go:294] MountVolume operation started for volume "kubernetes.io/secret/beb4b080-decb-11e6-90ec-0800276fa492-default-token-ppiyi" (spec.Name: "default-token-ppiyi") to pod "beb4b080-decb-11e6-90ec-0800276fa492" (UID: "beb4b080-decb-11e6-90ec-0800276fa492"). Volume is already mounted to pod, but remount was requested.
I0119 20:51:48.754312 5180 operation_executor.go:749] MountVolume.SetUp succeeded for volume "kubernetes.io/secret/beb4b080-decb-11e6-90ec-0800276fa492-default-token-ppiyi" (spec.Name: "default-token-ppiyi") pod "beb4b080-decb-11e6-90ec-0800276fa492" (UID: "beb4b080-decb-11e6-90ec-0800276fa492").
E0119 20:51:49.127449 5180 docker_manager.go:2094] container start failed: ImagePullBackOff: Back-off pulling image " "
Any idea how to debug from here.
I created a project and tried to import the template file since i dont have access to CLI and 2 components failed ( Gogs and Nexus )
Gogs error:
--> Scaling gogs-3 to 1
| --> Waiting up to 10m0s for pods in rc gogs-3 to become ready
| error: update acceptor rejected gogs-3: pods for rc "gogs-3" took longer than 600 seconds to become ready
Nexus Error:
--> Scaling nexus-4 to 1
| --> Waiting up to 10m0s for pods in rc nexus-4 to become ready
| error: update acceptor rejected nexus-4: pods for rc "nexus-4" took longer than 600 seconds to become ready
Kindly let me know.
I0906 03:59:41.853507 1 source.go:197] Downloading "https://github.com/OpenShiftDemos/openshift-cd-demo.git" ...
I0906 03:59:48.514236 1 source.go:208] Cloning source from https://github.com/OpenShiftDemos/openshift-cd-demo.git
F0906 03:59:52.093018 1 builder.go:204] Error: build error: error: pathspec 'master' did not match any file(s) known to git.
I'm getting the error below when I try to create the demo. It appears it has to do with building the pipeline in Jenkins. I've done the steps to enable the Pipeline tech preview feature but I'm not sure how to validate that and if that has any correlation to the build error.
Please let me know if you need more information.
oc v3.3.1.3
kubernetes v1.3.0+52492b4
features: Basic-Auth GSSAPI Kerberos SPNEGO
Error from logs:
Error from server: unrecognized build strategy: api.BuildStrategy{DockerStrategy:(*api.DockerBuildStrategy)(nil), SourceStrategy:(*api.SourceBuildStrategy)(nil), CustomStrategy:(*api.CustomBuildStrategy)(nil)}
I've encountered a problem while running the Jenkins pipeline in the "Deploy to DEV" stage, in the 5th line:
sh "oc start-build tasks --from-dir=oc-build --wait=true -n dev"
I've followed README's instructions with no further configuration.
I'm using Windows10 with 8GB RAM. SonarQube didn't get deployed. I've commented the pipeline's stage in which it is needed, so I guess it is not necessary to have it "up".
Thanks a lot in advance.
Installed script-security plugin and restarted Jenkins to deal with this issue
https://issues.jenkins-ci.org/browse/JENKINS-30414
Hi
I am using minishift 3.6 and i have got an error below step
oc process -f https://github.com/OpenShiftDemos/openshift-cd-demo/blob/ocp-3.6/cicd-template.yaml | oc create -f - -n cicd
error: failed to read input object (not a Template?): error converting YAML to JSON: yaml: line 326: mapping values are not allowed in this context
error: no objects passed to create
C:>oc version
oc v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
features: Basic-Auth
Server https://192.168.99.100:8443
openshift v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
C:>oc get project
NAME DISPLAY NAME STATUS
cicd CI/CD Active
dev Tasks - Dev Active
stage Tasks - Stage Active
Hi there,
I tried to create this demo from template via webconsole (import from yaml) and got this error message.
My platform is OSE 3.4. Does it make any difference in interpreting the template file ?
How can i Fix that issue ?
That's the error:
Failed to process the resource.
duplicated mapping key at line 14, column 1:
message: The CI/CD infrastructur ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.