From 72198a4077d981363b30d2ef90477d9061e9b97e Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Tue, 23 Apr 2019 13:59:52 -0400 Subject: [PATCH] Define jenkins jobs for the RIC dashboard Update to latest global-jjb that adds the required maven templates Change occurrences of oran-osc to o-ran-sc Change-Id: I1151f6f1c757f03e5fa616a7ab7fa1e8c5ec0896 Signed-off-by: Lott, Christopher (cl778h) --- README.md | 95 ++++++++++++++++++++++++++++++++++-- jjb/defaults.yaml | 25 ++++++++++ jjb/ric-dashboard/ric-dashboard.yaml | 36 ++++++++++++++ 3 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 jjb/ric-dashboard/ric-dashboard.yaml diff --git a/README.md b/README.md index 9e3ef6cf..ae43adc4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,93 @@ -# ci-management +# Continuous Integration for O-RAN SC at LF -This repo contains configuration files for Jenkins jobs for the O-RAN SC -project. +This repo contains configuration files for Jenkins jobs for the O-RAN +SC project. + +## Custom JJB templates for Docker Java projects + +Custom JJB templates are defined for projects that use Maven to +compile Java code and build a Docker image. These projects should use +the following jobs in the project.yaml file:: + + jobs: + - gerrit-maven-docker-verify + - gerrit-maven-docker-merge + - gerrit-maven-docker-stage + + +## Testing the templates + +These instructions explain how to test the templates using the Jenkins +sandbox. This catches errors before submitting the changes as Gerrit +reviews. + +### Prerequisites + +Install the Jenkins job builder: + + pip install jenkins-job-builder + +Check out the global JJB templates submodule within this repo: + + git submodule update --init + +### Test Locally + +Check sanity by running the Jenkins job-builder script in this directory: + + jenkins-jobs test -r jjb + +### Deploy the templates to the Jenkins sandbox + +Login (after requesting membership in group +oran-jenkins-sandbox-access) at the Jenkins sandbox: + + https://jenkins.oran-osc.org/sandbox + +Get the authentication token from the sandbox: + a) click on your user name (top right) + b) click Configure (left menu) + c) under API Token, click Add new Token (button) + d) copy the token string + +Create a config file jenkins.ini using the following template and your +credentials (user name and API token from above):: + + [job_builder] + ignore_cache=True + keep_descriptions=False + recursive=True + + [jenkins] + query_plugins_info=False + url=https://jenkins.oran-osc.org/sandbox + user=YOUR-USER-NAME + password=YOUR-API-TOKEN + +Build and deploy a specific job using the EXACT job name. + + jenkins-jobs --conf jenkins.ini update jjb your-job-name-here + +Examples: + + jenkins-jobs --conf jenkins.ini update jjb project-maven-docker-verify-master-mvn33-openjdk8 + +In the sandbox visit the job page, then click the button "Build with +parameters" in left menu. + +### How to build from a Gerrit review branch + +This explains how to launch a "verify" job in the Sandbox on an open +review. Most "verify" jobs accept parameters to build code in a +review submitted to Gerrit. You must specify the change ref spec, +which is a Git branch name. Get this by inspecting Gerrit's +"download" links at the top right. The branch name will be something +like this: + + refs/changes/78/578/2 + +The first number is a mystery to me; the second number is the Gerrit +change number; the third number is the patch set within the change. + +Enter this name for both the GERRIT_BRANCH and the GERRIT_REFSPEC +parameters, then click Build. diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml index 1da42f2e..b381d2eb 100644 --- a/jjb/defaults.yaml +++ b/jjb/defaults.yaml @@ -8,5 +8,30 @@ gerrit-server-name: gerrit.oran-osc.org jenkins-ssh-credential: jenkins lftools-version: <1.0.0 + + archive-artifacts: '' + + # Nexus3 docker registries + container-public-registry: nexus3.o-ran-sc.org:10001 + container-snapshot-registry: nexus3.o-ran-sc.org:10003 + container-staging-registry: nexus3.o-ran-sc.org:10004 + + # Default java version + java-version: openjdk8 + + # Default maven version + mvn-version: mvn35 + # Default maven goals + mvn-goals: 'clean install' + # Default JVM invocation options + mvn-opts: '' mvn-site-id: 'oran-site' mvn-staging-id: 'oran-staging' + mvn-snapshot-id: snapshots + staging-profile-id: 14a1ca3fc76ce + + # Nexus2 for jars + nexus-snapshot-repo: snapshots + + # Javadoc + javadoc-path: org.o-ran-sc.$PROJECT/$STREAM diff --git a/jjb/ric-dashboard/ric-dashboard.yaml b/jjb/ric-dashboard/ric-dashboard.yaml new file mode 100644 index 00000000..59b132dc --- /dev/null +++ b/jjb/ric-dashboard/ric-dashboard.yaml @@ -0,0 +1,36 @@ +--- +- project: + name: ric-dashboard-project-view + project-name: ric-dashboard + views: + - project-view + +- project: + name: portal-ric-dashboard-project + # jenkins job name prefix + project-name: ric-dashboard + # git repo + project: portal/ric-dashboard + mvn-settings: ric-dashboard-settings + mvn-params: -Dbuild.number=${{BUILD_NUMBER}} + nexus-iq-namespace: 'oran-' + build-node: ubuntu1804-docker-4c-4g + jobs: + - gerrit-maven-docker-verify + - gerrit-maven-docker-merge + - gerrit-maven-docker-stage + - '{project-name}-maven-javadoc-jobs' + # - gerrit-maven-clm + stream: + - master: + branch: master + +- project: + name: portal-ric-dashboard-sonar + project-name: ric-dashboard + project: portal/ric-dashboard + mvn-settings: ric-dashboard-settings + branch: master + build-node: ubuntu1804-docker-4c-4g + jobs: + - gerrit-maven-sonar -- 2.16.6