Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins release job #594

Merged
merged 39 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fd73295
Add cd-linchpin-release job to jenkins
May 11, 2018
25b11dd
Checkout pipeline job from SCM
May 11, 2018
e385b0d
add DOCKER_REPO_URL default
May 21, 2018
f004622
paas-bot is a string credential
May 21, 2018
ce5b949
Make pypiRepo a parameter
May 22, 2018
ad2859d
github_issue_547: Basic support for remote libvirt hypervisors
May 11, 2018
5b52199
Detail MANIFEST.in and setup.py
Jun 1, 2018
039b82a
Fixes ovirt role template error
jcpowermac May 31, 2018
1012ae3
Remove mode for local_image_path. Let umask do its job.
Jun 5, 2018
35c4cba
Update links to show directory
Jun 6, 2018
46e41b6
Remove untitled docs from search index
Jun 6, 2018
4f93cdc
Add footer.rst. Include in appropriate locations
Jun 6, 2018
68eadcb
update to install linchpin from test.pypi
Jun 14, 2018
3f02a37
add --pre option for dev versions
Jun 14, 2018
533638e
bump version for testing
Jun 14, 2018
62b1eae
bump to v1.5.5a5
Jun 14, 2018
fa238f8
Merge branch 'develop' of github.com:herlo/linchpin into develop-testing
Jun 14, 2018
7dba29b
bump to v1.5.5a6
Jun 14, 2018
dd2d085
bump to v1.5.5a7
Jun 14, 2018
a7162da
bump to v1.5.5a6
Jun 14, 2018
950a5aa
bump to v1.5.5a7
Jun 14, 2018
62538a8
bump to v1.5.5a8
Jun 14, 2018
86bd03b
Merge branch 'test_pypi_install' of github.com:herlo/linchpin into te…
Jun 14, 2018
88c45ba
bump to v1.5.5a9
Jun 14, 2018
cd2e90c
add -x
Jun 14, 2018
63655b5
bump to v1.5.5a10
Jun 14, 2018
bee0865
bump to v1.5.5a11
Jun 14, 2018
772e700
Add retries to pip download, version to 1.5.5a12
Jun 14, 2018
68c3a23
bump to v1.5.5a13
Jun 14, 2018
3c94588
update JenkinsfileRelease to release to production
Jun 14, 2018
6e7be2b
Updated the image for os-server testing
samvarankashyap Jun 14, 2018
ca952fc
bump version to 1.5.5a14
Jun 15, 2018
bc66ed4
bump version to 1.5.5a15
Jun 15, 2018
34d3a0f
test.pypi pip install fixes
Jun 15, 2018
1663155
bump version to 1.5.5a16
Jun 15, 2018
17c47ca
Error handling, push to master branch added
Jun 15, 2018
01d5186
Updated the image for os-server testing
samvarankashyap Jun 14, 2018
06a4c12
Merge branch 'jenkins_release_job' of github.com:herlo/linchpin into …
Jun 15, 2018
5e4032f
Adjusting repos from herlo to CentOS-PaaS-SIG
Jun 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 68 additions & 21 deletions config/Dockerfiles/JenkinsfileRelease
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,35 @@ import com.cloudbees.plugins.credentials.Credentials
executionID = UUID.randomUUID().toString()
// Use repoName everywhere for dirs and repo values
repoName = 'linchpin'

DOCKER_REPO_URL = env.DOCKER_REPO_URL ?: '172.30.254.79:5000'

env.ghprbGhRepository = env.ghprbGhRepository ?: 'CentOS-PaaS-SIG/' + repoName
//env.ghprbGhRepository = env.ghprbGhRepository ?: 'herlo/' + repoName

env.ghprbActualCommit = env.ghprbActualCommit ?: 'develop'
//env.ghprbActualCommit = env.ghprbActualCommit ?: 'test_pypi_install'

env.ghprbPullAuthorLogin = env.ghprbPullAuthorLogin ?: ''

env.TARGET_BRANCH = env.TARGET_BRANCH ?: 'develop'
//env.TARGET_BRANCH = env.TARGET_BRANCH ?: 'develop-testing'
env.MASTER_BRANCH = env.MASTER_BRANCH ?: 'master'
//env.MASTER_BRANCH = env.MASTER_BRANCH ?: 'master-testing'

env.TEST_PYPI_REPO = env.TEST_PYPI_REPO ?: 'pypitest'
env.PROD_PYPI_REPO = env.PROD_PYPI_REPO ?: 'pypi'


OPENSHIFT_NAMESPACE = env.OPENSHIFT_NAMESPACE ?: 'continuous-infra'
OPENSHIFT_SERVICE_ACCOUNT = env.OPENSHIFT_SERVICE_ACCOUNT ?: 'jenkins'

env.FEDORA27_TAG = env.FEDORA27_TAG ?: 'stable'

// Pod name to use
podName = repoName + executionID
jslave_podName = 'jslave-' + repoName + '_' + executionID

library identifier: "ci-pipeline@master",
retriever: modernSCM([$class: 'GitSCMSource',
remote: "https://github.com/CentOS-Paas-SIG/ci-pipeline"])
remote: "https://github.com/CentOS-PaaS-SIG/ci-pipeline"])

library identifier: "cico-pipeline-library@master",
retriever: modernSCM([$class: 'GitSCMSource',
Expand All @@ -43,23 +54,19 @@ properties([
string(defaultValue: 'develop',
description: '',
name: 'ghprbActualCommit'),
string(defaultValue: '',
description: '',
name: 'sha1'),
string(defaultValue: '',
description: 'Git Hub Repository',
name: 'ghprbGhRepository')
]
),
])

podTemplate(name: podName,
label: podName,
podTemplate(name: jslave_podName,
label: jslave_podName,
cloud: 'openshift',
serviceAccount: OPENSHIFT_SERVICE_ACCOUNT,
idleMinutes: 0,
namespace: OPENSHIFT_NAMESPACE,

containers: [
// This adds the custom slave container to the pod.
// Must be first with name 'jnlp'
Expand All @@ -69,12 +76,19 @@ podTemplate(name: podName,
alwaysPullImage: true,
args: '${computer.jnlpmac} ${computer.name}',
command: '',
workingDir: '/workDir'),
containerTemplate(name: 'fedora27',
alwaysPullImage: true,
image: DOCKER_REPO_URL + '/' + OPENSHIFT_NAMESPACE + '/fedora27:' + FEDORA27_TAG,
ttyEnabled: false,
command: '',
privileged: true,
workingDir: '/workDir')
]
)

{
node(podName) {
node(jslave_podName) {
ansiColor('xterm') {
timestamps {
// We need to set env.HOME because the openshift slave image
Expand All @@ -95,7 +109,7 @@ podTemplate(name: podName,
pipelineUtils.verifyPod(OPENSHIFT_NAMESPACE, env.NODE_NAME)
dir(repoName) {

withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'paas-bot', usernameVariable: 'GH_USER', passwordVariable: 'GH_TOKEN']]) {
withCredentials([string(credentialsId: 'paas-bot', variable: 'GH_TOKEN')]) {
checkout([$class: 'GitSCM',
branches: [[name: env.ghprbActualCommit]],
doGenerateSubmoduleConfigurations: false,
Expand All @@ -104,26 +118,27 @@ podTemplate(name: podName,
userRemoteConfigs : [
[refspec:
'+refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*',
url: "https://" + GH_USER + ":" + GH_TOKEN + "@github.com/${env.ghprbGhRepository}"]
url: "https://paas-bot:" + GH_TOKEN + "@github.com/${env.ghprbGhRepository}"]
]
])
}

}
}
stage('release-version') {
stage('release-test-version') {
dir(repoName) {

sh "git checkout " + env.ghprbActualCommit
sh "git config user.name 'LinchPin Releaser'"
sh "git config user.email 'linchpin@redhat.com'"
sh "python setup.py sdist bdist_wheel"

string version = sh (
script: "python setup.py --version",
returnStdout: true
).trim()
currentBuild.displayName = "Build#: ${env.BUILD_NUMBER} - Release: " + version
if (env.ghprbActualCommit != null && env.ghprbActualCommit != "develop") {
currentBuild.description = "<a href=\"https://github.com/${env.ghprbGhRepository}/pull/${env.ghprbPullId}\">Release: (" + version + ")</a>"
}
currentBuild.displayName = "Build#: ${env.BUILD_NUMBER} - LinchPin Release: " + version

withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'linchpin-releaser', usernameVariable: 'TWINE_USERNAME', passwordVariable: 'TWINE_PASSWORD']]) {
sh (
"""
Expand All @@ -144,12 +159,44 @@ username = ${TWINE_USERNAME}
password = ${TWINE_PASSWORD}
EOF

twine upload --config-file /tmp/pypirc --repository pypitest dist/*
"""
)
}
sh "git tag v" + version
sh "git push --tags origin develop"
sh "twine upload --config-file /tmp/pypirc -r " + env.TEST_PYPI_REPO + " dist/* || echo 'Version already uploaded'"
sh "git fetch origin " + TARGET_BRANCH
sh "git pull --tags origin " + TARGET_BRANCH
string tag = sh (
script: "git tag -l | grep v" + version + " || echo 'noversion'",
returnStdout: true
).trim()
if (tag != "v" + version) {
sh "git tag v" + version
sh "git push --tags origin " + env.ghprbActualCommit + ":" + TARGET_BRANCH
}
}
}
currentStage = 'test-pypi-install'
stage(currentStage) {
dir(repoName) {
pipelineUtils.executeInContainer(currentStage, "fedora27", "./config/Dockerfiles/linchpin-pip-install.sh " + version)
}
}
currentStage = "test-pypi-verify"
stage(currentStage) {
dir('linchpin') {
env.distro = "fedora27"
env.PROVIDERS = "dummy"
pipelineUtils.executeInContainer(currentStage, "fedora27", "./config/Dockerfiles/linchpin-tests.sh")
}
}
stage('release-prod-version') {
dir(repoName) {
sh "twine upload --config-file /tmp/pypirc -r " + env.PROD_PYPI_REPO + " dist/*"
}
}
stage('push-to-master') {
dir(repoName) {
sh "git push --tags origin " + env.ghprbActualCommit + ":" + MASTER_BRANCH
}
}
}
Expand Down
35 changes: 35 additions & 0 deletions config/Dockerfiles/linchpin-pip-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash -x

# This script installs linchpin from test.pypi.org
# used by cd-linchpin-release (JenkinsfileRelease)
# will only be used on the latest distro (currently
# fedora27 and the dummy provider).

VERSION=${1}
TMPDIR=$(mktemp -d)

PYPI=https://test.pypi.org/simple

pip install -U pip setuptools

# wait for test.pypi.org to have files
sleep 10

pip download linchpin==${VERSION} --index-url ${PYPI} --retries 10 --pre --no-deps --no-binary :all: -d ${TMPDIR}

# grab the requirements.txt from the linchpin package and intall those packages from production pypi
tar -xvf ${TMPDIR}/linchpin-${VERSION}.tar.gz -C ${TMPDIR} linchpin-${VERSION}/requirements.txt --strip-components=1
pip install -r ${TMPDIR}/requirements.txt

# once deps are installed from production pypi, install linchpin from test.pypi
pip install linchpin==${VERSION} --index-url ${PYPI}

# verify linchpin is installed
linchpin --version 2>&1 | grep ${VERSION}
if [ "${?}" -eq "0" ]; then
echo SUCCESS
exit 0
fi
echo FAILURE
exit 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="workflow-job@2.17">
<actions>
<org.jenkinsci.plugins.workflow.multibranch.JobPropertyTrackerAction plugin="workflow-multibranch@2.17">
<jobPropertyDescriptors>
<string>hudson.model.ParametersDefinitionProperty</string>
<string>com.coravy.hudson.plugins.github.GithubProjectProperty</string>
<string>jenkins.model.BuildDiscarderProperty</string>
</jobPropertyDescriptors>
</org.jenkinsci.plugins.workflow.multibranch.JobPropertyTrackerAction>
</actions>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<io.fabric8.jenkins.openshiftsync.BuildConfigProjectProperty plugin="openshift-sync@1.0.7">
<uid></uid>
<namespace></namespace>
<name></name>
<resourceVersion></resourceVersion>
</io.fabric8.jenkins.openshiftsync.BuildConfigProjectProperty>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>-1</daysToKeep>
<numToKeep>20</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>20</artifactNumToKeep>
</strategy>
</jenkins.model.BuildDiscarderProperty>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.29.0">
<projectUrl>https://github.com/CentOS-PaaS-SIG/linchpin/</projectUrl>
<displayName></displayName>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
<com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.3">
<gitLabConnection></gitLabConnection>
</com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.27">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>ghprbActualCommit</name>
<description></description>
<defaultValue>develop</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>sha1</name>
<description></description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>ghprbGhRepository</name>
<description>Git Hub Repository</description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers>
<com.cloudbees.jenkins.GitHubPushTrigger plugin="github@1.29.0">
<spec></spec>
</com.cloudbees.jenkins.GitHubPushTrigger>
</triggers>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
</properties>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="workflow-cps@2.45">
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.8.0">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://github.com/CentOS-PaaS-SIG/linchpin</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>${ghprbActualCommit}</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.ChangelogToBranch>
<options>
<compareRemote>origin</compareRemote>
<compareTarget>develop</compareTarget>
</options>
</hudson.plugins.git.extensions.impl.ChangelogToBranch>
</extensions>
</scm>
<scriptPath>config/Dockerfiles/JenkinsfileRelease</scriptPath>
<lightweight>true</lightweight>
</definition>
<triggers/>
<disabled>false</disabled>
</flow-definition>
19 changes: 13 additions & 6 deletions config/s2i/jenkins/slave/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
FROM openshift/jenkins-slave-base-centos7:v3.7
FROM openshift/jenkins-slave-base-centos7:v3.6
##
## -------------------------------------> ^^ this is needed
## since the centosCI openshift cluster
## is running 3.6 and the slave needs the
## correct 'oc' binary to work properly
## This should be updated when the cluster
## is upgraded.
##

# Install dependencies for JenkinsfileRelease
# add ruby for ghi
RUN yum install -y epel-release
RUN yum install -y gcc python-devel libyaml-devel \
RUN yum install -y epel-release; \
yum install -y gcc python-devel libyaml-devel \
python-pip python-setuptools python-wheel python-twine \
ansible jq ruby && yum clean all && rm -rf /var/cache/yum

RUN pip install -U pip setuptools wheel twine
ansible jq ruby && yum clean all && rm -rf /var/cache/yum; \
pip install -U pip setuptools wheel twine
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource_groups:
- name: "{{ distro | default('') }}frontend"
role: os_server
flavor: m1.small
image: Fedora-Cloud-Base-26-compose-latest
image: CentOS-7-x86_64-GenericCloud-1612
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be switched back? I know sk had to change this because the CentOS image was missing? Or do I have it backwards?

count: 1
keypair: ci-factory
auto_ip: no
Expand Down
2 changes: 1 addition & 1 deletion linchpin/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__short_version__ = '1.5.5'
__version__ = '1.5.5a1'
__version__ = '1.5.5a16'