diff options
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/releng/releng-release-create-branch.sh | 37 | ||||
-rw-r--r-- | jjb/releng/releng-release-jobs.yml | 119 | ||||
-rw-r--r-- | jjb/releng/releng-release-verify.sh | 27 |
3 files changed, 183 insertions, 0 deletions
diff --git a/jjb/releng/releng-release-create-branch.sh b/jjb/releng/releng-release-create-branch.sh new file mode 100644 index 000000000..ec8365340 --- /dev/null +++ b/jjb/releng/releng-release-create-branch.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +set -xe + +# Configure the git user/email as we'll be pushing up changes +git config user.name "jenkins-ci" +git config user.email "jenkins-opnfv-ci@opnfv.org" + +# Ensure we are able to generate Commit-IDs for new patchsets +curl -kLo .git/hooks/commit-msg https://gerrit.opnfv.org/gerrit/tools/hooks/commit-msg +chmod +x .git/hooks/commit-msg + +# Activate virtualenv, supressing shellcheck warning +# shellcheck source=/dev/null +. $WORKSPACE/venv/bin/activate +pip install -r releases/scripts/requirements.txt + +STREAM=${STREAM:-'nostream'} +RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM") + +for release_file in $RELEASE_FILES; do + python releases/scripts/create_branch.py -f $release_file + python releases/scripts/create_jobs.py -f $release_file + NEW_FILES=$(git status --porcelain --untracked=no | cut -c4-) + if [ -n "$NEW_FILES" ]; then + git add $NEW_FILES + git commit -m "Create Stable Branch Jobs for $(basename $release_file .yaml)" + git push origin HEAD:refs/for/master + fi +done diff --git a/jjb/releng/releng-release-jobs.yml b/jjb/releng/releng-release-jobs.yml new file mode 100644 index 000000000..b581b163c --- /dev/null +++ b/jjb/releng/releng-release-jobs.yml @@ -0,0 +1,119 @@ +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +- project: + name: releng-release-jobs + + stream: + - fraser + + jobs: + - 'releng-release-{stream}-verify' + - 'releng-release-{stream}-merge' + + project: 'releng' + +- job-template: + name: 'releng-release-{stream}-verify' + + parameters: + - stream-parameter: + stream: '{stream}' + - project-parameter: + project: '{project}' + branch: 'master' + + scm: + - git-scm-gerrit + + triggers: + - gerrit: + server-name: 'gerrit.opnfv.org' + trigger-on: + - patchset-created-event: + exclude-drafts: 'false' + exclude-trivial-rebase: 'false' + exclude-no-code-change: 'false' + - comment-added-contains-event: + comment-contains-value: 'recheck' + - comment-added-contains-event: + comment-contains-value: 'reverify' + projects: + - project-compare-type: 'ANT' + project-pattern: 'releng' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/master' + file-paths: + - compare-type: ANT + pattern: 'releases/{stream}/**' + - compare-type: ANT + pattern: 'releases/schema.yaml' + - compare-type: ANT + pattern: 'releases/scripts/verify_schema.py' + + builders: + - create-virtualenv + - shell: + !include-raw-escape: releng-release-verify.sh + + publishers: + - email-jenkins-admins-on-failure + +- job-template: + name: 'releng-release-{stream}-merge' + + parameters: + - node: + name: SLAVE_NAME + description: 'Only run merge job on build1' + default-slaves: + - lf-build1 + allowed-multiselect: false + ignore-offline-nodes: true + - stream-parameter: + stream: '{stream}' + - project-parameter: + project: '{project}' + branch: 'master' + + scm: + - git-scm-gerrit + + triggers: + - gerrit-trigger-change-merged: + project: '{project}' + branch: 'master' + files: 'releases/**' + + builders: + - create-virtualenv + - shell: + !include-raw-escape: releng-release-create-branch.sh + + publishers: + - email-jenkins-admins-on-failure + +- parameter: + name: stream-parameter + parameters: + - string: + name: STREAM + default: '{stream}' + description: "OPNFV Stable Stream" + +- builder: + name: create-virtualenv + builders: + - shell: | + #!/bin/bash + sudo pip install virtualenv + virtualenv $WORKSPACE/venv + . $WORKSPACE/venv/bin/activate + pip install --upgrade pip diff --git a/jjb/releng/releng-release-verify.sh b/jjb/releng/releng-release-verify.sh new file mode 100644 index 000000000..c1262e2c9 --- /dev/null +++ b/jjb/releng/releng-release-verify.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +set -xe + +# Activate virtualenv, supressing shellcheck warning +# shellcheck source=/dev/null +. $WORKSPACE/venv/bin/activate +pip install -r releases/scripts/requirements.txt + +STREAM=${STREAM:-'nostream'} +RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM") + +# TODO: The create_branch.py should be refactored so it can be used here +# to verify the commit exists that is being added, along with +# jjb/<project> +for release_file in $RELEASE_FILES; do + python releases/scripts/verify_schema.py \ + -s releases/schema.yaml \ + -y $release_file +done |