From affc7232951621511281c8e64b0d756372ff9d1e Mon Sep 17 00:00:00 2001 From: "Kochetov, Mikhail (mk899x)" Date: Tue, 11 Jul 2017 12:40:07 -0600 Subject: [PATCH 1/6] Add KollaBuild Job --- Jenkinsfile | 99 ++++++++++++++++++++++++++++++++ osh/seedjobs/KollaBuild.groovy | 102 +++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 Jenkinsfile create mode 100644 osh/seedjobs/KollaBuild.groovy diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f1f8186 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,99 @@ +#!/usr/bin/env groovy + +properties([ + [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], + parameters([ + string(defaultValue: 'nova glance kestone', + description: 'components with custom images', + name: 'COMPONENTS_LIST'), + booleanParam(defaultValue: true, + description: 'Install/Re-install openstack-kolla, If your slave already have it installed you can set it to false (uncheck)', + name: 'INSTALL_KOLLA'), + booleanParam(defaultValue: true, + description: 'Install/Re-install openstack-helm, If your slave already have it installed you can set it to false (uncheck)', + name: 'INSTALL_OSH') + ]), + [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 'project'], pipelineTriggers([]) +]) + +node('slave') { + stage('slave precheck') { + sh '''#!/bin/bash -xe + sudo apt-get install -y python-pip libpython-all-dev libpython3-all-dev libffi-dev libssl-dev gcc git ntp tox ansible docker.io + if [ -z "${COMPONENTS_LIST}" ];then + echo "ERROR: COMPONENTS_LIST parameter is empty" + exit 1 + fi + echo ${COMPONENT_LIST} + echo 'Precheck complete!' + ''' + } + stage('deploy Kolla') { + sh '''#!/bin/bash -xe + + if ! ${INSTALL_KOLLA}; then + echo "Skipping installation phase" + exit 0 + fi + + echo "Kolla deployment" + rm -rf kolla/ + git clone https://git.openstack.org/openstack/kolla -b stable/newton + pip install kolla/ + cd kolla/ + tox -e py27 + tox -e genconfig + ''' + } + + stage('Generate Images') { + sh '''#!/bin/bash -xe + cd kolla + source .tox/py27/bin/activate + for os_component in ${COMPONENTS_LIST}; do + kolla-build -b ubuntu -t source ${os_component} + done + ''' + } + + stage('deploy OSH') { + sh '''#!/bin/bash -xe + + if ! ${INSTALL_OSH}; then + echo "Skipping installation phase" + exit 0 + fi + + rm -rf openstack-helm/ + git clone https://github.com/openstack/openstack-helm.git + + export INTEGRATION=aio INTEGRATION_TYPE=basic + + cd openstack-helm + + bash tools/gate/setup_gate.sh + ''' + } + + stage('Upgrade images') { + sh '''#!/bin/bash -xe + echo ${COMPONENTS_LIST} + cd openstack-helm/ + for os_component in ${COMPONENTS_LIST}; do + sed -i 's|docker.io/kolla|kolla|g' ${os_component}/values.yaml + helm upgrade -f ${os_component}/values.yaml ${os_component} ${os_component} + done + ''' + } + + stage('Rally') { + sh '''#!/bin/bash -xe + ''' + } + + stage('Results') { + sh '''#!/bin/bash -xe + ''' + } + +} diff --git a/osh/seedjobs/KollaBuild.groovy b/osh/seedjobs/KollaBuild.groovy new file mode 100644 index 0000000..89c638f --- /dev/null +++ b/osh/seedjobs/KollaBuild.groovy @@ -0,0 +1,102 @@ +#!/usr/bin/env groovy + +properties([ + [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], + parameters([ + string(defaultValue: 'nova glance kestone', + description: 'components with custom images', + name: 'COMPONENTS_LIST'), + booleanParam(defaultValue: true, + description: 'Install/Re-install openstack-kolla, If your slave already have it installed you can set it to false (uncheck)', + name: 'INSTALL_KOLLA'), + booleanParam(defaultValue: true, + description: 'Install/Re-install openstack-helm, If your slave already have it installed you can set it to false (uncheck)', + name: 'INSTALL_OSH') + ]), + [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 'project'], pipelineTriggers([]) +]) + +node('slave') { + stage('slave precheck') { + sh '''#!/bin/bash -xe + sudo apt-get install -y python-pip libpython-all-dev libpython3-all-dev libffi-dev libssl-dev gcc git ntp tox ansible docker.io + if ! id | grep -q docker; then + #sudo adduser $USER docker + fi + if [ -z "${COMPONENTS_LIST}" ];then + echo "ERROR: COMPONENTS_LIST parameter is empty" + exit 1 + fi + echo ${COMPONENT_LIST} + echo 'Precheck complete!' + ''' + } + stage('deploy Kolla') { + sh '''#!/bin/bash -xe + + if ! ${INSTALL_KOLLA}; then + echo "Skipping installation phase" + exit 0 + fi + + echo "Kolla deployment" + rm -rf kolla/ + git clone https://git.openstack.org/openstack/kolla -b stable/newton + pip install kolla/ + cd kolla/ + tox -e py27 + tox -e genconfig + ''' + } + + stage('Generate Images') { + sh '''#!/bin/bash -xe + cd kolla + source .tox/py27/bin/activate + for os_component in ${COMPONENTS_LIST}; do + kolla-build -b ubuntu -t source ${os_component} + done + ''' + } + + stage('deploy OSH') { + sh '''#!/bin/bash -xe + + if ! ${INSTALL_OSH}; then + echo "Skipping installation phase" + exit 0 + fi + + rm -rf openstack-helm/ + git clone https://github.com/openstack/openstack-helm.git + + export INTEGRATION=aio INTEGRATION_TYPE=basic + + cd openstack-helm + + bash tools/gate/setup_gate.sh + ''' + } + + stage('Upgrade images') { + sh '''#!/bin/bash -xe + echo ${COMPONENTS_LIST} + cd openstack-helm/ + for os_component in ${COMPONENTS_LIST}; do + sed -i 's|docker.io/kolla|kolla|g' ${os_component}/values.yaml + helm upgrade -f ${os_component}/values.yaml ${os_component} ${os_component} + done + ''' + } + + stage('Rally') { + sh '''#!/bin/bash -xe + ''' + } + + stage('Results') { + sh '''#!/bin/bash -xe + ''' + } + +} From f32c35ea966ca3256badc895c05528eb50ff0b72 Mon Sep 17 00:00:00 2001 From: "Kochetov, Mikhail (mk899x)" Date: Fri, 14 Jul 2017 10:49:15 -0600 Subject: [PATCH 2/6] KollaBuild sudo fix --- osh/seedjobs/KollaBuild.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osh/seedjobs/KollaBuild.groovy b/osh/seedjobs/KollaBuild.groovy index 89c638f..4302b4a 100644 --- a/osh/seedjobs/KollaBuild.groovy +++ b/osh/seedjobs/KollaBuild.groovy @@ -21,7 +21,7 @@ node('slave') { sh '''#!/bin/bash -xe sudo apt-get install -y python-pip libpython-all-dev libpython3-all-dev libffi-dev libssl-dev gcc git ntp tox ansible docker.io if ! id | grep -q docker; then - #sudo adduser $USER docker + sudo adduser $USER docker||: fi if [ -z "${COMPONENTS_LIST}" ];then echo "ERROR: COMPONENTS_LIST parameter is empty" From a38faefb396acd8593c0998e856538a2e3cef537 Mon Sep 17 00:00:00 2001 From: "Kochetov, Mikhail (mk899x)" Date: Fri, 14 Jul 2017 11:28:40 -0600 Subject: [PATCH 3/6] the seond Jenkinsfile in the test folder --- test/Jenkinsfile | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/Jenkinsfile diff --git a/test/Jenkinsfile b/test/Jenkinsfile new file mode 100644 index 0000000..a31b7ac --- /dev/null +++ b/test/Jenkinsfile @@ -0,0 +1,67 @@ +pipeline { + agent { + // "node" is a new agent type that works the same as "label" but allows + // additional parameters, such as "customWorkspace" below. + node { + label "some-label" + // This is equivalent to the "ws(...)" step - sets the workspace on the + // agent to a hard-coded path. If it's not an absolute path, it'll be + // relative to the agent's workspace root. + customWorkspace "/use/this/path/instead" + } + } + + // Shared libraries can now be loaded in through the Declarative syntax, + // as shown below. + libraries { + lib("some-lib@master") + } + + // REGRESSION: JENKINS-42748 - string escaping for Windows paths in + // "environment" when using single quotes. This is being investigated. + environment { + FOO = "BAR" + // Environment variables can now reference other environment variables! + BARCAMP = "${FOO}CAMP" + // They can also reference the workspace path! + PATH_IN_WS = "${WORKSPACE}/child/path" + } + + stages { + stage('some-stage') { + // REGRESSION: JENKINS-42762 - in 1.1.1, you can't nest multiple + // conditions directly within "when". You need to use "when { allOf { ... } }" + // instead. This will be fixed in the next release. + when { + // We have added logical conditions for "when" - specifically... + + // "anyOf" - contains 1 or more nested condition and will resolve + // to true if *any* of the nested conditions are true. + anyOf { + // "allOf" - contains 1 or more nested conditions an will resolve + // to true if *all* of the nested conditions are true. + allOf { + branch "master" + expression { + // REGRESSION: JENKINS-42829 - methods defined elsewhere in + // the Jenkinsfile currently can't be used in "when" "expression"s. + return true + } + } + // "not" - contains 1 nested condition and will resolve to true + // if the nested condition is false. + not { + branch "some-other-branch-entirely" + } + } + } + steps { + // We've added the "validateDeclarativePipeline('some-file')" step, + // which will let you perform validation of a Declarative Pipeline + // from within a different Pipeline. This step can be used in + // Scripted Pipeline as well. + echo validateDeclarativePipeline("some-other-file.groovy") + } + } + } +} \ No newline at end of file From 5e46ef05dac9f85877c46a3468760bad90cdd714 Mon Sep 17 00:00:00 2001 From: "Kochetov, Mikhail (mk899x)" Date: Fri, 14 Jul 2017 14:25:00 -0600 Subject: [PATCH 4/6] Jenkinsfile moved + slack integration test --- osh/seedjobs/Jenkinsfile | 119 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 osh/seedjobs/Jenkinsfile diff --git a/osh/seedjobs/Jenkinsfile b/osh/seedjobs/Jenkinsfile new file mode 100644 index 0000000..3cd0384 --- /dev/null +++ b/osh/seedjobs/Jenkinsfile @@ -0,0 +1,119 @@ +#!/usr/bin/env groovy + +properties([ + [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], + parameters([ + string(defaultValue: 'nova glance kestone', + description: 'components with custom images', + name: 'COMPONENTS_LIST' + ), + booleanParam( + defaultValue: true, + description: 'Install/Re-install openstack-kolla, If your slave already have it installed you can set it to false (uncheck)', + name: 'INSTALL_KOLLA' + ), + booleanParam( + defaultValue: true, + description: 'Install/Re-install openstack-helm, If your slave already have it installed you can set it to false (uncheck)', + name: 'INSTALL_OSH' + ) + ]), + + [$class: 'ThrottleJobProperty', categories: [], + limitOneJobWithMatchingParams: false, + maxConcurrentPerNode: 0, + maxConcurrentTotal: 0, + paramsToUseForLimit: '', + throttleEnabled: false, + throttleOption: 'project' + ], + pipelineTriggers([]) +]) + +node('slave') { + stage('slave precheck') { + slackSend channel: '#test-jenkins', + color: 'good', + message: 'slackSend "started ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"', + teamDomain: 'att-comdev', + tokenCredentialId: 'comdev-slack' + + sh '''#!/bin/bash -xe + sudo apt-get install -y python-pip libpython-all-dev libpython3-all-dev libffi-dev libssl-dev gcc git ntp tox ansible docker.io + if [ -z "${COMPONENTS_LIST}" ];then + echo "ERROR: COMPONENTS_LIST parameter is empty" + exit 1 + fi + echo ${COMPONENT_LIST} + echo 'Precheck complete!' + ''' + } + stage('deploy Kolla') { + sh '''#!/bin/bash -xe + + if ! ${INSTALL_KOLLA}; then + echo "Skipping installation phase" + exit 0 + fi + + echo "Kolla deployment" + rm -rf kolla/ + git clone https://git.openstack.org/openstack/kolla -b stable/newton + pip install kolla/ + cd kolla/ + tox -e py27 + tox -e genconfig + ''' + } + + stage('Generate Images') { + sh '''#!/bin/bash -xe + cd kolla + source .tox/py27/bin/activate + for os_component in ${COMPONENTS_LIST}; do + kolla-build -b ubuntu -t source ${os_component} + done + ''' + } + + stage('deploy OSH') { + sh '''#!/bin/bash -xe + + if ! ${INSTALL_OSH}; then + echo "Skipping installation phase" + exit 0 + fi + + rm -rf openstack-helm/ + git clone https://github.com/openstack/openstack-helm.git + + export INTEGRATION=aio INTEGRATION_TYPE=basic + + cd openstack-helm + + bash tools/gate/setup_gate.sh + ''' + } + + stage('Upgrade images') { + sh '''#!/bin/bash -xe + echo ${COMPONENTS_LIST} + cd openstack-helm/ + for os_component in ${COMPONENTS_LIST}; do + sed -i 's|docker.io/kolla|kolla|g' ${os_component}/values.yaml + helm upgrade -f ${os_component}/values.yaml ${os_component} ${os_component} + done + ''' + } + + stage('Rally') { + sh '''#!/bin/bash -xe + ''' + } + + stage('Results') { + sh '''#!/bin/bash -xe + ''' + } + +} From 4d750f0b96a46fa9e42b079aee17e351067824a0 Mon Sep 17 00:00:00 2001 From: "Kochetov, Mikhail (mk899x)" Date: Fri, 14 Jul 2017 14:54:54 -0600 Subject: [PATCH 5/6] New workspace ~/TEST --- osh/seedjobs/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/osh/seedjobs/Jenkinsfile b/osh/seedjobs/Jenkinsfile index 3cd0384..60a77d9 100644 --- a/osh/seedjobs/Jenkinsfile +++ b/osh/seedjobs/Jenkinsfile @@ -31,6 +31,7 @@ properties([ ]) node('slave') { + customWorkspace "~/TEST/" stage('slave precheck') { slackSend channel: '#test-jenkins', color: 'good', From 841719c5c8fb10822b3fd3c03f472bd15c9d505f Mon Sep 17 00:00:00 2001 From: "Kochetov, Mikhail (mk899x)" Date: Thu, 10 Aug 2017 10:20:43 -0600 Subject: [PATCH 6/6] Test change --- osh/seedjobs/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/osh/seedjobs/Jenkinsfile b/osh/seedjobs/Jenkinsfile index 60a77d9..03a2de2 100644 --- a/osh/seedjobs/Jenkinsfile +++ b/osh/seedjobs/Jenkinsfile @@ -114,6 +114,7 @@ node('slave') { stage('Results') { sh '''#!/bin/bash -xe + echo SUCCESS ''' }