diff options
| -rw-r--r-- | jjb/.gitignore | 1 | ||||
| -rw-r--r-- | jjb/requirements.txt | 1 | ||||
| -rwxr-xr-x | jjb/run.sh | 5 | ||||
| -rw-r--r-- | jjb/yaml/openbook-pipeline.yaml | 8 | ||||
| -rw-r--r-- | pillar/openbook/ansible.sls | 5 | ||||
| -rw-r--r-- | salt/openbook/ansible/files/deploy-dev-env.sh | 2 | ||||
| -rw-r--r-- | salt/openbook/ansible/files/find_next_tag.sh | 14 |
7 files changed, 33 insertions, 3 deletions
diff --git a/jjb/.gitignore b/jjb/.gitignore index cfe5767..bdcf3b6 100644 --- a/jjb/.gitignore +++ b/jjb/.gitignore @@ -1,2 +1,3 @@ pippiandcarlos.com.ini verizoncloudplatform.com.ini +venv diff --git a/jjb/requirements.txt b/jjb/requirements.txt new file mode 100644 index 0000000..1d847f4 --- /dev/null +++ b/jjb/requirements.txt @@ -0,0 +1 @@ +jenkins-job-builder>=2.0.0.0b2 @@ -1,4 +1,9 @@ #!/bin/bash ini="${1}" + +virtualenv venv +. venv/bin/activate +venv/bin/pip install --upgrade -r requirements.txt + jenkins-jobs --conf "${ini}" update --delete-old yaml/ diff --git a/jjb/yaml/openbook-pipeline.yaml b/jjb/yaml/openbook-pipeline.yaml index 75cf363..52536b0 100644 --- a/jjb/yaml/openbook-pipeline.yaml +++ b/jjb/yaml/openbook-pipeline.yaml @@ -22,6 +22,9 @@ customWorkspace "workspace/{artifact}" }} }} + environment {{ + NEW_TAG = "4.1.1" + }} stages {{ stage("gradle") {{ steps {{ @@ -36,7 +39,8 @@ ] ] ) - sh(script: "gradle -PbuildNumber=4.1.${{BUILD_NUMBER}} -PbuildMode=buildProd -Dorg.gradle.daemon=false clean shadowJar") + sh(script: "NEW_TAG=\$(/var/lib/jenkins/find_next_tag.sh \$(pwd) 4.1)") + sh(script: "gradle -PbuildNumber=${{NEW_TAG}} -PbuildMode=buildProd -Dorg.gradle.daemon=false clean shadowJar") stash(includes: "build/libs/*.jar", name: "jar") }} }} @@ -57,7 +61,7 @@ ] ) unstash(name: "jar") - sh(script: "ruby openbook/ruby/upload_jar.rb --webdav-url=${{WEBDAV_URL}} --webdav-username=${{WEBDAV_USERNAME}} --webdav-password=${{WEBDAV_PASSWORD}} --artifact={artifact} --version=4.1.${{BUILD_NUMBER}} --filepath=build/libs/{artifact}.4.1.${{BUILD_NUMBER}}.jar") + sh(script: "ruby openbook/ruby/upload_jar.rb --webdav-url=${{WEBDAV_URL}} --webdav-username=${{WEBDAV_USERNAME}} --webdav-password=${{WEBDAV_PASSWORD}} --artifact={artifact} --version=${{NEW_TAG}} --filepath=build/libs/{artifact}.${{NEW_TAG}}.jar") }} }} stage("docker-container") {{ diff --git a/pillar/openbook/ansible.sls b/pillar/openbook/ansible.sls index ba0aa08..a6495a1 100644 --- a/pillar/openbook/ansible.sls +++ b/pillar/openbook/ansible.sls @@ -186,3 +186,8 @@ ansible: source: openbook_docker_slave_installer.yaml mode: "0644" is_template: False + find_next_tag_sh: + name: /var/lib/jenkins/find_next_tag.sh + source: find_next_tag.sh + mode: "0755" + is_template: False diff --git a/salt/openbook/ansible/files/deploy-dev-env.sh b/salt/openbook/ansible/files/deploy-dev-env.sh index b47774e..176ae6f 100644 --- a/salt/openbook/ansible/files/deploy-dev-env.sh +++ b/salt/openbook/ansible/files/deploy-dev-env.sh @@ -8,5 +8,5 @@ rm -f env.yaml ln -s env.yaml.openbook env.yaml popd pushd ${buildroot} -ansible-playbook -i inventory_json.rb openbook_installer.yaml +ansible-playbook -vvv -i inventory_json.rb openbook_installer.yaml popd diff --git a/salt/openbook/ansible/files/find_next_tag.sh b/salt/openbook/ansible/files/find_next_tag.sh new file mode 100644 index 0000000..638215c --- /dev/null +++ b/salt/openbook/ansible/files/find_next_tag.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cd "${1}" +basetag="${2}" + +lastbuild=$(git for-each-ref --sort=taggerdate --format '%(tag)' | grep -F "${basetag}" | tail -n 1 | awk -F. '{print $3}') +if [ "${lastbuild}" == "" ]; then + newtag="${basetag}.1" +else + newtag="${basetag}.$(( ${lastbuild} + 1 ))" +fi +git tag -a "build-${newtag}" -m "tagged by jenkins: $(date)" +git push origin "build-${newtag}" +echo -n "${newtag}" |
