new maven plugin jobs to build and deploy maven plugins to maven nexus
This patch adds jobs to build maven plugins and deploy them to the maven nexus repo at https://oss.sonatype.org Closes-Bug: #1082812 Change-Id: I283d475ab18819391f282234b063522abbf09eda
This commit is contained in:
parent
2723fcd7cb
commit
9aef0e90d8
@ -494,6 +494,8 @@ node 'pypi.slave.openstack.org' {
|
||||
jenkins_ssh_public_key => $openstack_project::jenkins_ssh_key,
|
||||
jenkinsci_username => hiera('jenkins_ci_org_user'),
|
||||
jenkinsci_password => hiera('jenkins_ci_org_password'),
|
||||
mavencentral_username => hiera('mavencentral_org_user'),
|
||||
mavencentral_password => hiera('mavencentral_org_password'),
|
||||
}
|
||||
}
|
||||
|
||||
|
44
modules/jenkins/files/slave_scripts/mavencentral-upload.sh
Normal file
44
modules/jenkins/files/slave_scripts/mavencentral-upload.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash -x
|
||||
#
|
||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Upload java packages to maven repositories
|
||||
|
||||
PROJECT=$1
|
||||
VERSION=$2
|
||||
META_DATA_FILE=$3
|
||||
PLUGIN_FILE=$4
|
||||
|
||||
# Strip project name and extension leaving only the version.
|
||||
VERSION=`echo ${PLUGIN_FILE} | sed -n "s/${PROJECT}-\(.*\).jar/\1/p"`
|
||||
|
||||
# generate pom file with version info
|
||||
POM_IN_ZIP=`unzip -Z -1 ${PLUGIN_FILE}|grep pom.xml`
|
||||
unzip -o -j ${PLUGIN_FILE} ${POM_IN_ZIP}
|
||||
sed "s/\${{project-version}}/${VERSION}/g" <pom.xml >${META_DATA_FILE}
|
||||
|
||||
# deploy plugin artifacts from workspace to maven central repository
|
||||
MAVEN_REPO="https://oss.sonatype.org/content/groups/public/maven"
|
||||
MAVEN_REPO_CREDS="/home/jenkins/.mavencentral-curl"
|
||||
|
||||
curl -X PUT \
|
||||
--config ${MAVEN_REPO_CREDS} \
|
||||
--data-binary @${META_DATA_FILE} \
|
||||
-i "${MAVEN_REPO}/${PROJECT}/${VERSION}/${META_DATA_FILE}" > /dev/null 2>&1
|
||||
|
||||
curl -X PUT \
|
||||
--config ${MAVEN_REPO_CREDS} \
|
||||
--data-binary @${PLUGIN_FILE} \
|
||||
-i "${MAVEN_REPO}/${PROJECT}/${VERSION}/${PLUGIN_FILE}" > /dev/null 2>&1
|
@ -0,0 +1,89 @@
|
||||
# usig a freestyle project to work around jenkins bug:
|
||||
# https://issues.jenkins-ci.org/browse/JENKINS-14193
|
||||
|
||||
- job-template:
|
||||
name: 'gate-{name}-build'
|
||||
node: precise
|
||||
|
||||
wrappers:
|
||||
- timeout:
|
||||
timeout: 30
|
||||
fail: true
|
||||
- timestamps
|
||||
|
||||
builders:
|
||||
- gerrit-git-prep
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
/usr/local/jenkins/slave_scripts/maven-properties.sh
|
||||
- inject:
|
||||
properties-file: maven.properties
|
||||
- maven-target:
|
||||
maven-version: Maven3
|
||||
pom: pom.xml
|
||||
goals: 'clean package'
|
||||
properties:
|
||||
- project-version=${{PROJECT_VER}}
|
||||
|
||||
publishers:
|
||||
- console-log
|
||||
|
||||
- job-template:
|
||||
name: '{name}-localrepo-upload'
|
||||
node: precise
|
||||
|
||||
wrappers:
|
||||
- timeout:
|
||||
timeout: 30
|
||||
fail: true
|
||||
- timestamps
|
||||
|
||||
builders:
|
||||
- gerrit-git-prep
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
/usr/local/jenkins/slave_scripts/maven-properties.sh
|
||||
- inject:
|
||||
properties-file: maven.properties
|
||||
- maven-target:
|
||||
maven-version: Maven3
|
||||
pom: pom.xml
|
||||
goals: 'clean package'
|
||||
properties:
|
||||
- project-version=${{PROJECT_VER}}
|
||||
|
||||
publishers:
|
||||
- war:
|
||||
site: 'tarballs.openstack.org'
|
||||
warfile: 'target/{name}-${{PROJECT_VER}}.jar'
|
||||
target: 'tarballs/ci/{name}'
|
||||
- console-log
|
||||
|
||||
- job-template:
|
||||
name: '{name}-mavencentral-upload'
|
||||
node: pypi
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash -xe
|
||||
TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'`
|
||||
FILENAME_BIN="{name}-$TAG.jar"
|
||||
|
||||
# copy plugin artifacts from tarballs to local workspace
|
||||
rm -rf *.jar
|
||||
curl -o $FILENAME_BIN http://{tarball-site}/ci/{name}/$FILENAME_BIN
|
||||
|
||||
# deploy to maven repository
|
||||
FILENAME_POM="{name}-$TAG.pom"
|
||||
/usr/local/jenkins/slave_scripts/mavencentral-upload.sh {name} $TAG \
|
||||
$FILENAME_POM $FILENAME_BIN
|
||||
|
||||
publishers:
|
||||
- console-log
|
||||
|
||||
- job-group:
|
||||
name: maven-plugin-jobs
|
||||
jobs:
|
||||
- 'gate-{name}-build'
|
||||
- '{name}-localrepo-upload'
|
||||
- '{name}-mavencentral-upload'
|
@ -362,6 +362,15 @@
|
||||
jobs:
|
||||
- jenkins-plugin-jobs
|
||||
|
||||
- project:
|
||||
name: clouddocs-maven-plugin
|
||||
maven-group-id: com.rackspace.cloud.api
|
||||
github-org: stackforge
|
||||
node: precise
|
||||
tarball-site: tarballs.openstack.org
|
||||
|
||||
jobs:
|
||||
- maven-plugin-jobs
|
||||
|
||||
- project:
|
||||
name: zmq-event-publisher
|
||||
|
@ -1750,9 +1750,14 @@ projects:
|
||||
|
||||
- name: stackforge/clouddocs-maven-plugin
|
||||
check:
|
||||
- gate-noop
|
||||
- gate-clouddocs-maven-plugin-build
|
||||
gate:
|
||||
- gate-noop
|
||||
- gate-clouddocs-maven-plugin-build
|
||||
post:
|
||||
- clouddocs-maven-plugin-localrepo-upload
|
||||
release:
|
||||
- clouddocs-maven-plugin-localrepo-upload:
|
||||
- clouddocs-maven-plugin-mavencentral-upload
|
||||
|
||||
- name: stackforge/congress
|
||||
check:
|
||||
|
@ -52,4 +52,13 @@ class openstack_project::pypi_slave (
|
||||
require => File['/home/jenkins'],
|
||||
}
|
||||
|
||||
file { '/home/jenkins/.mavencentral-curl':
|
||||
ensure => present,
|
||||
owner => 'jenkins',
|
||||
group => 'jenkins',
|
||||
mode => '0600',
|
||||
content => template('openstack_project/mavencentral-curl.erb'),
|
||||
require => File['/home/jenkins'],
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
user = "<%= mavencentral_username %>:<%= mavencentral_password %>"
|
Loading…
Reference in New Issue
Block a user