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/Jenkinsfile b/osh/seedjobs/Jenkinsfile new file mode 100644 index 0000000..03a2de2 --- /dev/null +++ b/osh/seedjobs/Jenkinsfile @@ -0,0 +1,121 @@ +#!/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') { + customWorkspace "~/TEST/" + 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 + echo SUCCESS + ''' + } + +} diff --git a/osh/seedjobs/KollaBuild.groovy b/osh/seedjobs/KollaBuild.groovy new file mode 100644 index 0000000..4302b4a --- /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 + ''' + } + +} 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