Coder Social home page Coder Social logo

pipeline-example's Introduction

Creating your own pipeline

Video 1: Creating your own pipeline

The build configuration used for creating the pipeline is https://github.com/VeerMuchandi/pipeline-example/blob/master/pipeline.yml

Video 2: Edit the pipeline to deploy across projects

The initial Jenkinsfile is https://github.com/VeerMuchandi/pipeline-example/blob/master/Jenkinsfile1.txt

The edited Jenkinsfile is https://github.com/VeerMuchandi/pipeline-example/blob/master/Jenkinsfile2.txt

In this example, the pipeline runs in the CICD Project. We will build and deploy an application first in a project named 'Development'. Later we will push the image created into a project named 'Testing'.

Here are the commands I used from the OpenShift CLI:

Creating a development Project and to provide edit access to the jenkins service account in the development project.

oc new-project development

oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n development

Creating a testing Project . Provide edit access to the jenkins service account in the testing project. Then provide image-puller access, so that testing project can pull an image from the development project.

oc new-project testing

oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n testing

oc policy add-role-to-group system:image-puller system:serviceaccounts:testing -n development

To create a deployment configuration in the testing project that points to the image from development project, create a service and route:

oc create deploymentconfig myapp --image=<<RegistryServiceIP>>:5000/development/myapp:promoteToQA

oc expose dc myapp --port=8080

oc expose svc myapp

pipeline-example's People

Contributors

veermuchandi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pipeline-example's Issues

import of pipeline.yml didnt work

My first pipeline try on openshift 3.3 and per your video 1 i tried to import your build config and it didnt seem to do anything. Did i do anything wrong?

`-bash-4.2$ oc get bc
NAME TYPE FROM LATEST
myfirstpipeline JenkinsPipeline 0
-bash-4.2$ oc describe bc myfirstpipeline
Name: myfirstpipeline
Namespace: developer-cicd
Created: 35 seconds ago
Labels: name=myfirstpipeline
Annotations: pipeline.alpha.openshift.io/uses=[{"name": "myphp", "namespace": "", "kind": "DeploymentConfig"}]
Latest Version: Never built

Strategy: JenkinsPipeline
Jenkinsfile contents:
node('maven') {
stage 'build'
openshiftBuild(buildConfig: 'myphp', showBuildLogs: 'true')
stage 'deploy'
openshiftDeploy(deploymentConfig: 'myphp')
openshiftScale(deploymentConfig: 'myphp',replicaCount: '2')
}
Empty Source: no input source provided

Build Run Policy: Serial
Triggered by:
Webhook GitHub:
URL: https://oseserver:8443/oapi/v1/namespaces/developer-cicd/buildconfigs/myfirstpipeline/webhooks/secret101/github
Webhook Generic:
URL: https://oseserver:8443/oapi/v1/namespaces/developer-cicd/buildconfigs/myfirstpipeline/webhooks/secret101/generic
AllowEnv: false`

Pipeline Failed - While Start Build Pipeline

penShift Build devopspoc/myfirstpipeline-1
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/jobs/devopspoc/jobs/devopspoc-myfirstpipeline/workspace
[Pipeline] {
[Pipeline] stage (build)
Using the ‘stage’ step without a block argument is deprecated
Entering stage build
Proceeding
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NoSuchMethodError: No such DSL method 'openshiftBuild' found among steps [_OcAction, _OcContextInit, _OcWatch, archive, bat, build, catchError, checkout, container, containerLog, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, envVarsForTool, error, fileExists, findFiles, getContext, git, input, isUnix, jiraComment, jiraIssueSelector, jiraSearch, junit, library, libraryResource, load, lock, mail, milestone, node, nodesByLabel, parallel, podTemplate, powershell, properties, publishHTML, pwd, readFile, readJSON, readManifest, readMavenPom, readProperties, readTrusted, readYaml, resolveScm, retry, script, sh, sha1, sleep, stage, stash, step, svn, tee, timeout, tm, tool, touch, unarchive, unstash, unzip, validateDeclarativePipeline,

deploying of application to openshift fails

I am new to openshift. I tried jenkins pipeline with the same buildconfig yml file and also the same php application. After starting the pipeline the build is successful but the deployment fails. I am getting the below output in jenkins console.
Pushing image 172.30.198.246:5000/cicd/myphp:latest ...
Pushed 0/7 layers, 1% complete
Pushed 1/7 layers, 16% complete
Pushed 2/7 layers, 33% complete
Pushed 3/7 layers, 49% complete
Pushed 4/7 layers, 62% complete
Pushed 5/7 layers, 92% complete
Pushed 6/7 layers, 97% complete
Pushed 7/7 layers, 100% complete
Push successful

Exiting "Trigger OpenShift Build" successfully; build "myphp-2" has completed with status: [Complete].
[Pipeline] stage (deploy)
Using the ‘stage’ step without a block argument is deprecated
Entering stage deploy
Proceeding
[Pipeline] openshiftDeploy

Starting "Trigger OpenShift Deployment" with deployment config "myphp" from the project "cicd".
Operation will timeout after 600000 milliseconds

Exiting "Trigger OpenShift Deployment" unsuccessfully; gave up on deployment "myphp-1" with status: [Running].
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: "Trigger OpenShift Deployment" failed
Finished: FAILURE

I don't know where I am commiting mistake. Please help me in this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.