Giter Site home page Giter Site logo

jee-ex-jgitflow's Introduction

jee-ex

A sample app to be deployed on openshift environments

Note: to build this repository with maven you must specify "-Popenshift", eg "mvn clean package -Popenshift"

Integration with Jenkins

To trigger a build when a push is made to GitHub, do the following:

For Pipeline type jobs

  1. Create a Pipeline job in Jenkins, with the following config:

    • Tick 'GitHub Project' and set Project URL to: https://github.com/monodot/jee-ex-jgitflow - note that Jenkins will add a trailing slash; this is fine. This URL must not end in .git

    • Tick the box labelled 'GitHub hook trigger for GITScm polling'

    • Configure the job with this pipeline:

        node {
            stage('Hello') {
                git url: 'https://github.com/monodot/jgit-flow-demo.git', branch: "master"
            }
        }
      
  2. Edit the job (using Configure) and then Save it again. (This seems to be required by the plugin.)

  3. Now build the job manually. The job must have run successfully at least once in order for the GitHub trigger to be fired.

  4. Now make a commit and push to GitHub. This should trigger the job in Jenkins.

For Multibranch type jobs

Multibranch jobs in Jenkins allow a job to be created automatically for each branch in the repository. Note that each branch in the remote repository must contain a Jenkinsfile in its root.

  1. Create a Multibranch Pipeline job in Jenkins, with the following config:

    • Add a Source, choosing Git as the type.
    • Specify the Project Repository as: https://github.com/monodot/jee-ex-jgitflow.git
    • Add a Pipeline Library:
      • Name: pipeline-library
      • Default version: master
      • Project repo
  2. In GitHub, go to Settings → Integrations & services and add the Jenkins (Git plugin) integration.

    • Set the Jenkins URL to (e.g.) http://yourjenkins:8080 or http://abc123456.ngrok.io
  3. Now whenever you push to GitHub, a job will be triggered in Jenkins for the given branch.

Testing with local Jenkins

The Jenkinsfile in this repository assumes that Jenkins will be executing builds on maven slave nodes (e.g. using OpenShift/Kubernetes). If using a local instance of Jenkins to test, you will need to define a maven node, so that the pipeline can run:

  1. Go to Manage Jenkins → Manage Nodes → New Node.

  2. Add a new node with the following properties:

    • Name: maven
    • Remote root directory: /path/to/a/writeable/directory
    • Usage: Only build jobs with label expressions matching this node
    • Launch method: Launch slave agents via SSH
    • Host: localhost
    • Credentials: (add your SSH credentials here)
    • Host Key Verification Strategy: Non verifying Verification Strategy

jee-ex-jgitflow's People

Contributors

bparees avatar danmcp avatar monodot avatar

Watchers

James Cloos avatar  avatar  avatar

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.