Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

allow spaces in Jenkins job names. [addresses #80] #99

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion buildtestvms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#
# this will tell Foreman to rebuild all machines in hostgroup TESTVM_HOSTGROUP

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

if [[ -z ${PUSH_USER} ]] || [[ -z ${SATELLITE} ]] || [[ -z ${RSA_ID} ]] \
|| [[ -z ${ORG} ]] || [[ -z ${TESTVM_HOSTCOLLECTION} ]]
Expand Down
4 changes: 3 additions & 1 deletion capsule-sync-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# While a Capsule Sync is in progress, we must wait
# as the System Under Test (SUT) may be behind a Capsule

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

if [[ -z ${PUSH_USER} ]] || [[ -z ${SATELLITE} ]] || [[ -z ${RSA_ID} ]] \
|| [[ -z ${ORG} ]] || [[ -z ${TESTVM_HOSTCOLLECTION} ]]
Expand Down
4 changes: 3 additions & 1 deletion cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# e.g. ${WORKSPACE}/scripts/cleanup.sh
#

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

if [[ ! -n "${WORKSPACE}" || ! -d "${WORKSPACE}" ]]
then
Expand Down
2 changes: 1 addition & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SRPMBUILD_ERR=6
MODBUILD_ERR=7

function tell() {
echo "${@} [$(date)]" | fold -s
echo "${@} [$(date)]" | fold --spaces --width=240
}

function inform() {
Expand Down
98 changes: 64 additions & 34 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,23 @@ If unset/false, all existing hosts, within the given Host Collection, will be re
<hudson.model.StringParameterDefinition>
<name>MOCK_CONFIG</name>
<description>This will be passed to mock --root
e.g. mock --root rhel-6-x86_64
e.g. mock --root rhel-7-x86_64
needed to ensure we can build RPMs against more then just the default mock chroot.</description>
<defaultValue>rhel-6-x86_64</defaultValue>
<defaultValue>rhel-7-x86_64</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>PUPPET_DONE_SLEEP</name>
<description>Number of seconds to wait in puppet-done-test.sh
if you set up things with puppet that take a while to settle (e.g. NTP), you may want to wait a bit (e.g. 75 seconds
is good for ntp to settle)</description>
<defaultValue>75</defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="org.jenkinsci.plugins.multiplescms.MultiSCM" plugin="multiple-scms@0.3">
<scm class="org.jenkinsci.plugins.multiplescms.MultiSCM" plugin="multiple-scms@0.6">
<scms>
<hudson.plugins.git.GitSCM plugin="git@2.2.7">
<hudson.plugins.git.GitSCM plugin="git@3.5.1">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
Expand All @@ -131,7 +138,7 @@ needed to ensure we can build RPMs against more then just the default mock chroo
</hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
</extensions>
</hudson.plugins.git.GitSCM>
<hudson.plugins.git.GitSCM plugin="git@2.2.7">
<hudson.plugins.git.GitSCM plugin="git@3.5.1">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
Expand All @@ -157,62 +164,70 @@ needed to ensure we can build RPMs against more then just the default mock chroo
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers>
<hudson.triggers.SCMTrigger>
<spec>* * * * * </spec>
<ignorePostCommitHooks>false</ignorePostCommitHooks>
</hudson.triggers.SCMTrigger>
</triggers>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>echo &quot;#####################################################&quot;
<command>#!/bin/bash

echo &quot;#####################################################&quot;
echo &quot;# BUILDING RPMS #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/rpmbuild.sh ${WORKSPACE}/soe/rpms
&quot;${WORKSPACE}/scripts/rpmbuild.sh&quot; &quot;${WORKSPACE}/soe/rpms&quot;

echo &quot;#####################################################&quot;
echo &quot;# BUILDING PUPPET MODULES #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/puppetbuild.sh ${WORKSPACE}/soe/puppet
&quot;${WORKSPACE}/scripts/puppetbuild.sh&quot; &quot;${WORKSPACE}/soe/puppet&quot;

echo &quot;#####################################################&quot;
echo &quot;# BUILDING KICKSTARTS #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/kickstartbuild.sh ${WORKSPACE}/soe/kickstarts
</command>
&quot;${WORKSPACE}/scripts/kickstartbuild.sh&quot; &quot;${WORKSPACE}/soe/kickstarts&quot;</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>echo &quot;#####################################################&quot;
<command>#!/bin/bash

echo &quot;#####################################################&quot;
echo &quot;# PUSH RPMS TO SATELLITE #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/rpmpush.sh ${WORKSPACE}/artefacts
&quot;${WORKSPACE}/scripts/rpmpush.sh&quot; &quot;${WORKSPACE}/artefacts&quot;

echo &quot;#####################################################&quot;
echo &quot;# PUSH PUPPET MODULES TO SATELLITE #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/puppetpush.sh ${WORKSPACE}/artefacts
&quot;${WORKSPACE}/scripts/puppetpush.sh&quot; &quot;${WORKSPACE}/artefacts&quot;

echo &quot;#####################################################&quot;
echo &quot;# PUSH KICKSTARTS TO SATELLITE #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/kickstartpush.sh ${WORKSPACE}/artefacts
&quot;${WORKSPACE}/scripts/kickstartpush.sh&quot; &quot;${WORKSPACE}/artefacts&quot;

echo &quot;#####################################################&quot;
echo &quot;# REPUBLISH CONTENT VIEW #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/publishcv.sh</command>
&quot;${WORKSPACE}/scripts/publishcv.sh&quot;

echo &quot;#####################################################&quot;
echo &quot;# WAIT FOR CAPSULE SYNC #&quot;
echo &quot;#####################################################&quot;
&quot;${WORKSPACE}/scripts/capsule-sync-check.sh&quot;</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>echo &quot;#####################################################&quot;
<command>#!/bin/bash

echo &quot;#####################################################&quot;
echo &quot;# REBUILDING TEST VMS #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/buildtestvms.sh
</command>
&quot;${WORKSPACE}/scripts/buildtestvms.sh&quot;</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>echo &quot;#####################################################&quot;
<command>#!/bin/bash

echo &quot;#####################################################&quot;
echo &quot;# PUSHING TESTS to TEST VMS #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/pushtests.sh
</command>
&quot;${WORKSPACE}/scripts/pushtests.sh&quot;</command>
</hudson.tasks.Shell>
<org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder plugin="[email protected]">
<condition class="org.jenkins_ci.plugins.run_condition.core.StatusCondition" plugin="[email protected]">
Expand All @@ -230,17 +245,23 @@ echo &quot;#####################################################&quot;
</bestResult>
</condition>
<buildStep class="hudson.tasks.Shell">
<command>echo &quot;#####################################################&quot;
echo &quot;# CLEAN-UP AFTER SUCCESS BUILD #&quot;
echo &quot;#####################################################&quot;
/bin/bash -x ${WORKSPACE}/scripts/cleanup.sh
</command>
<command>#!/bin/bash

echo &quot;#####################################################&quot;
echo &quot;# POWER OFF TEST VMs #&quot;
echo &quot;#####################################################&quot;
&quot;${WORKSPACE}/scripts/powerofftestvms.sh&quot;

echo &quot;#####################################################&quot;
echo &quot;# CLEAN-UP AFTER SUCCESS BUILD #&quot;
echo &quot;#####################################################&quot;
&quot;${WORKSPACE}/scripts/cleanup.sh&quot;</command>
</buildStep>
<runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail" plugin="[email protected]"/>
</org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder>
</builders>
<publishers>
<org.tap4j.plugin.TapPublisher plugin="tap@1.20">
<org.tap4j.plugin.TapPublisher plugin="tap@2.1">
<testResults>test_results/*.tap</testResults>
<failIfNoResults>false</failIfNoResults>
<failedTestsMarkBuildAsFailure>false</failedTestsMarkBuildAsFailure>
Expand All @@ -252,7 +273,16 @@ echo &quot;#####################################################&quot;
<validateNumberOfTests>false</validateNumberOfTests>
<planRequired>true</planRequired>
<verbose>true</verbose>
<showOnlyFailures>false</showOnlyFailures>
<stripSingleParents>false</stripSingleParents>
<flattenTapResult>false</flattenTapResult>
<skipIfBuildNotOk>false</skipIfBuildNotOk>
</org.tap4j.plugin.TapPublisher>
<hudson.tasks.Mailer plugin="[email protected]">
<recipients>[email protected]</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>
</hudson.tasks.Mailer>
</publishers>
<buildWrappers/>
</project>
</project>
25 changes: 21 additions & 4 deletions kickstartbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,32 @@
# e.g. ${WORKSPACE}/scripts/kickstartbuild.sh ${WORKSPACE}/soe/kickstarts/
#

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

printf -v escaped_1 %q "${1}"

if [[ -z ${escaped_1} ]]
then
usage "$0 <directory containing kickstart files>"
warn "the test zero length failed for ${escaped_1}"
warn "you used $0 $@"
exit ${NOARGS}
fi

if [[ -z "$1" ]] || [[ ! -d "$1" ]]
if [[ ! -d "${1}" ]]
then
usage "$0 <directory containing kickstart files>"
warn "the test directory exists failed for ${1}"
warn "you used $0 $@"
exit ${NOARGS}
fi

workdir=$1
printf -v escaped_workdir %q "${1}"
printf -v escaped_WORKSPACE %q "${WORKSPACE}"

if [[ -z ${WORKSPACE} ]] || [[ ! -w ${WORKSPACE} ]]
then
Expand All @@ -22,8 +39,8 @@ then
fi

# setup artefacts environment
ARTEFACTS=${WORKSPACE}/artefacts/kickstarts
mkdir -p $ARTEFACTS
ARTEFACTS="${WORKSPACE}/artefacts/kickstarts"
mkdir -p "${ARTEFACTS}"

# copy erb files from one directory to the next, creating directory if needed
rsync -td --out-format="#%n#" --delete-excluded --include=*.erb --exclude=* \
Expand Down
24 changes: 20 additions & 4 deletions kickstartpush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@
# e.g. ${WORKSPACE}/scripts/kickstartpush.sh ${WORKSPACE}/artefacts/kickstarts/
#

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

printf -v escaped_1 %q "${1}"

if [[ -z ${escaped_1} ]]
then
usage "$0 <kickstarts directory>"
warn "the test zero length failed for ${escaped_1}"
warn "you used $0 $@"
exit ${NOARGS}
fi

if [[ -z "$1" ]] || [[ ! -d "$1" ]]
if [[ ! -d "${1}" ]]
then
usage "$0 <kickstarts directory>"
warn "the test directory exists failed for ${1}"
warn "you used $0 $@"
exit ${NOARGS}
fi

workdir=$1
printf -v escaped_workdir %q "${1}"

if [[ -z ${PUSH_USER} ]] || [[ -z ${SATELLITE} ]]
then
Expand All @@ -23,10 +39,10 @@ fi

# We delete extraneous kickstarts on the satellite so that we don't keep pushing the same kickstarts into foreman
rsync --delete -va -e "ssh -l ${PUSH_USER} -i /var/lib/jenkins/.ssh/id_rsa" -va \
${workdir}/kickstarts/ ${SATELLITE}:kickstarts
"${workdir}/kickstarts/" ${SATELLITE}:kickstarts

# either update or create each kickstart in turn
cd ${workdir}/kickstarts
cd "${workdir}/kickstarts"
for I in *.erb
do
name=$(sed -n 's/^name:\s*\(.*\)/\1/p' ${I})
Expand Down
4 changes: 3 additions & 1 deletion powerofftestvms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
# e.g ${WORKSPACE}/scripts/powerofftestvms.sh 'test'
#

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

if [[ -z ${PUSH_USER} ]] || [[ -z ${SATELLITE} ]] || [[ -z ${RSA_ID} ]] \
|| [[ -z ${ORG} ]] || [[ -z ${TESTVM_HOSTCOLLECTION} ]]
Expand Down
6 changes: 4 additions & 2 deletions publishcv.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -x
#!/bin/bash

# Publish the content view(s) and promote if necessary
#
Expand All @@ -8,8 +8,10 @@
# CV_PASSIVE_LIST="cv-passive-1,cv-passive-2" ORG=Default_Organization \
# CCV_NAME_PATTERN="ccv-test-*" BUILD_URL=$$ ./publishcv.sh

#set -x

# Load common parameter variables
. $(dirname "${0}")/common.sh
source scripts/common.sh

# has anything changed? If yes, then MODIFIED_CONTENT_FILE is not 0 bytes
if [[ ! -s "${MODIFIED_CONTENT_FILE}" ]]
Expand Down
Loading