name: 'functest-defaultparameters'
repo: opnfv
tag:
- - gambia
- - hunter
- - latest
+ - gambia:
+ branch: stable/gambia
+ - hunter:
+ branch: stable/hunter
+ - latest:
+ branch: master
- job-template:
name: '{repo}-functest-{container}-{tag}-pull'
- name: '{repo}-functest-vnf-{tag}-pull'
- name: '{repo}-functest-features-{tag}-pull'
-- functest-buildparameters: &functest-buildparameters
- name: 'functest-buildparameters'
- parameters:
- - functest-virtual-defaults
- - string:
- name: branch
- default: master
-
- job-template:
name: '{repo}-functest-{container}-{test}-{tag}-run'
parameters:
test:
- tempest_full
- tempest_scenario
+ - rally_full
jobs:
- '{repo}-functest-{container}-{test}-{tag}-run'
projects:
- name: '{repo}-functest-components-tempest_full-{tag}-run'
- name: '{repo}-functest-components-tempest_scenario-{tag}-run'
+ # - name: '{repo}-functest-components-rally_full-{tag}-run'
- project:
name: repo-functest-vnf-{test}-{tag}-run
name: '{repo}-functest-{tag}-daily'
<<: *functest-defaultparameters
project-type: multijob
+ triggers:
+ - timed: '@daily'
+ properties:
+ - build-blocker:
+ use-build-blocker: true
+ block-level: 'NODE'
+ queue-scanning: 'BUILDABLE'
+ blocking-jobs:
+ - '{repo}-functest-.*-.*'
parameters:
- functest-virtual-defaults
builders:
- multijob:
name: components
<<: *functest-componentsjobs
- - multijob:
- name: vnf
- <<: *functest-vnfjobs
+ # - multijob:
+ # name: vnf
+ # <<: *functest-vnfjobs
- multijob:
name: features
<<: *functest-featuresjobs
jobs:
- '{repo}-functest-{tag}-daily'
+- functest-gateparameters: &functest-gateparameters
+ name: 'functest-gateparameters'
+ parameters:
+ - functest-virtual-defaults
+
+- functest-checkparameters: &functest-checkparameters
+ name: 'functest-checkparameters'
+ parameters:
+ - functest-virtual-defaults
+ - string:
+ name: BRANCH
+ default: '{branch}'
+
+- builder:
+ name: build-containers
+ builders:
+ - shell: |
+ case "{container}" in
+ "components")
+ args="" ;;
+ *)
+ args="--build-arg BRANCH={ref}" ;;
+ esac
+ cd docker/{container}
+ sudo docker build \
+ ${{args}} --pull=false --no-cache --force-rm=true \
+ -t {repo}/functest-{container}:{tag} .
+
- scm:
- name: functest-gerrit
+ name: functest-scm
scm:
- git:
url: https://gerrit.opnfv.org/gerrit/functest
refspec: '+refs/changes/*:refs/changes/*'
branches:
- - ${branch}
+ - '{ref}'
+
+- functest-buildparameters: &functest-buildparameters
+ name: 'functest-buildparameters'
+ container: '{container}'
+ repo: '{repo}'
+ tag: '{tag}'
- job-template:
- name: '{repo}-functest-{container}-{tag}-build'
- <<: *functest-buildparameters
+ name: '{repo}-functest-{container}-{tag}-gate'
+ <<: *functest-gateparameters
scm:
- - functest-gerrit
+ - functest-scm:
+ ref: $GERRIT_REFSPEC
builders:
- - shell: |
- case "{container}" in
- "components")
- args="" ;;
- *)
- args="--build-arg BRANCH=${{branch}}" ;;
- esac
- cd docker/$(echo {container} |cut -d\- -f 2)
- sudo docker build \
- ${{args}} --pull=false --no-cache --force-rm=true \
- -t {repo}/functest-{container}:{tag} .
+ - build-containers:
+ ref: $GERRIT_REFSPEC
+ <<: *functest-buildparameters
+
+- job-template:
+ name: '{repo}-functest-{container}-{tag}-check'
+ <<: *functest-checkparameters
+ scm:
+ - functest-scm:
+ ref: $BRANCH
+ builders:
+ - build-containers:
+ ref: $BRANCH
+ <<: *functest-buildparameters
- project:
name: repo-functest-container-tag-build
- vnf
- features
jobs:
- - '{repo}-functest-{container}-{tag}-build'
+ - '{repo}-functest-{container}-{tag}-gate'
+ - '{repo}-functest-{container}-{tag}-check'
- functest-projectparameters: &functest-projectparameters
name: 'functest-projectparameters'
- job-template:
name: '{repo}-functest-{tag}-gate'
project-type: multijob
- <<: *functest-buildparameters
+ <<: *functest-gateparameters
+ triggers:
+ - gerrit-trigger-patchset-created:
+ project: 'functest'
+ branch: '{branch}'
+ files: '**'
+ properties:
+ - build-blocker:
+ use-build-blocker: true
+ block-level: 'NODE'
+ queue-scanning: 'BUILDABLE'
+ blocking-jobs:
+ - '{repo}-functest-.*-.*'
builders:
- multijob:
name: build functest-core
projects:
- - name: '{repo}-functest-core-{tag}-build'
+ - name: '{repo}-functest-core-{tag}-gate'
<<: *functest-projectparameters
- multijob:
name: build functest-tempest
projects:
- - name: '{repo}-functest-tempest-{tag}-build'
+ - name: '{repo}-functest-tempest-{tag}-gate'
<<: *functest-projectparameters
- multijob:
name: build all remaining contrainers
projects:
- - name: '{repo}-functest-healthcheck-{tag}-build'
+ - name: '{repo}-functest-healthcheck-{tag}-gate'
<<: *functest-projectparameters
- - name: '{repo}-functest-smoke-{tag}-build'
+ - name: '{repo}-functest-smoke-{tag}-gate'
<<: *functest-projectparameters
- - name: '{repo}-functest-benchmarking-{tag}-build'
+ - name: '{repo}-functest-benchmarking-{tag}-gate'
<<: *functest-projectparameters
- - name: '{repo}-functest-components-{tag}-build'
+ - name: '{repo}-functest-components-{tag}-gate'
<<: *functest-projectparameters
- - name: '{repo}-functest-vnf-{tag}-build'
+ - name: '{repo}-functest-vnf-{tag}-gate'
<<: *functest-projectparameters
- - name: '{repo}-functest-features-{tag}-build'
+ - name: '{repo}-functest-features-{tag}-gate'
<<: *functest-projectparameters
- multijob:
name: healthcheck
- multijob:
name: components
<<: *functest-componentsjobs
+ # - multijob:
+ # name: vnf
+ # <<: *functest-vnfjobs
+ - multijob:
+ name: features
+ <<: *functest-featuresjobs
+
+- job-template:
+ name: '{repo}-functest-{tag}-check'
+ project-type: multijob
+ <<: *functest-checkparameters
+ properties:
+ - build-blocker:
+ use-build-blocker: true
+ block-level: 'NODE'
+ queue-scanning: 'BUILDABLE'
+ blocking-jobs:
+ - '{repo}-functest-.*-.*'
+ builders:
+ - multijob:
+ name: build functest-core
+ projects:
+ - name: '{repo}-functest-core-{tag}-check'
+ <<: *functest-projectparameters
+ - multijob:
+ name: build functest-tempest
+ projects:
+ - name: '{repo}-functest-tempest-{tag}-check'
+ <<: *functest-projectparameters
+ - multijob:
+ name: build all remaining contrainers
+ projects:
+ - name: '{repo}-functest-healthcheck-{tag}-check'
+ <<: *functest-projectparameters
+ - name: '{repo}-functest-smoke-{tag}-check'
+ <<: *functest-projectparameters
+ - name: '{repo}-functest-benchmarking-{tag}-check'
+ <<: *functest-projectparameters
+ - name: '{repo}-functest-components-{tag}-check'
+ <<: *functest-projectparameters
+ - name: '{repo}-functest-vnf-{tag}-check'
+ <<: *functest-projectparameters
+ - name: '{repo}-functest-features-{tag}-check'
+ <<: *functest-projectparameters
- multijob:
- name: vnf
- <<: *functest-vnfjobs
+ name: healthcheck
+ <<: *functest-healthcheckjobs
+ - multijob:
+ name: smoke
+ <<: *functest-smokejobs
+ - multijob:
+ name: benchmarking
+ <<: *functest-benchmarkingjobs
+ - multijob:
+ name: components
+ <<: *functest-componentsjobs
+ # - multijob:
+ # name: vnf
+ # <<: *functest-vnfjobs
- multijob:
name: features
<<: *functest-featuresjobs
- project:
- name: repo-functest-tag-gate
+ name: repo-functest-tag-build
<<: *functest-defaultparameters
jobs:
- '{repo}-functest-{tag}-gate'
+ - '{repo}-functest-{tag}-check'
--- /dev/null
+#!/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 -e -o pipefail
+
+GIT_URL=${GIT_URL:-https://gerrit.opnfv.org/gerrit}
+STREAM=${STREAM:-'nostream'}
+RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM")
+
+echo "--> Verifying $RELEASE_FILES."
+for release_file in $RELEASE_FILES; do
+ # Verify the release file schema
+ python releases/scripts/verify_schema.py \
+ -s releases/schema.yaml \
+ -y $release_file
+done
+
+for release_file in $RELEASE_FILES; do
+ while read -r repo branch ref; do
+ echo "$repo" "$branch" "$ref"
+ unset branch_actual
+ branch_actual="$(git ls-remote "https://gerrit.opnfv.org/gerrit/$repo.git" "refs/heads/$branch" | awk '{print $1}')"
+
+ if [ -n "$branch_actual" ]; then
+ echo "$repo refs/heads/$branch already exists at $branch_actual"
+ echo "RUN releng-release-create-venv.sh"
+ source jjb/releng/releng-release-tagging.sh
+ else
+ echo "This is a branching job"
+ source jjb/releng/releng-release-create-branch.sh
+ fi
+
+ done < <(python releases/scripts/repos.py -b -f "$release_file")
+done
##############################################################################
set -xe
+GIT_URL=${GIT_URL:-https://gerrit.opnfv.org/gerrit}
+STREAM=${STREAM:-'nostream'}
+RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM")
+
# Configure the git user/email as we'll be pushing up changes
git config --global user.name "jenkins-ci"
git config --global user.email "jenkins-opnfv-ci@opnfv.org"
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
+clone_repo(){
+echo "--> Cloning $repo"
+if [ ! -d $repo ]; then
+ git clone $GIT_URL/$repo.git $repo
+fi
+}
-STREAM=${STREAM:-'nostream'}
-RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM")
+check_if_ref_exists(){
+clone_repo
+cd "$repo"
+if git rev-list refs/heads/master | grep "$ref"; then
+ echo "$ref exists"
+ REF_EXISTS=true
+ cd -
+else
+ echo "$ref Does not exist please submit a valid ref for branching"
+ exit 1
+fi
+}
-for release_file in $RELEASE_FILES; do
+run_merge(){
+unset NEW_FILES
+if [[ $REF_EXISTS = true && "$JOB_NAME" =~ "merge" ]]; then
+ ssh -n -f -p 29418 gerrit.opnfv.org gerrit create-branch "$repo" "$branch" "$ref"
+ python releases/scripts/create_jobs.py -f $release_file
+ NEW_FILES=$(git status --porcelain --untracked=no | cut -c4-)
+fi
+if [ -n "$NEW_FILES" ]; then
+ git add $NEW_FILES
+ git commit -sm "Create Stable Branch Jobs for $(basename $release_file .yaml)"
+ git push origin HEAD:refs/for/master
+fi
+}
+main(){
+for release_file in $RELEASE_FILES; do
while read -r repo branch ref; do
-
echo "$repo" "$branch" "$ref"
branches="$(git ls-remote "https://gerrit.opnfv.org/gerrit/$repo.git" "refs/heads/$branch")"
-
if ! [ -z "$branches" ]; then
echo "refs/heads/$branch already exists at $ref ($branches)"
else
- ssh -n -f -p 29418 gerrit.opnfv.org gerrit create-branch "$repo" "$branch" "$ref"
+ run_merge
fi
-
done < <(python releases/scripts/repos.py -b -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 -sm "Create Stable Branch Jobs for $(basename $release_file .yaml)"
- git push origin HEAD:refs/for/master
- fi
done
+}
+
+check_if_ref_exists
+main