[docs] Limit git submodule recurse to depth 1
[releng.git] / jjb / releng / releng-release-create-branch.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -xe
11
12 # Configure the git user/email as we'll be pushing up changes
13 git config --global user.name "jenkins-ci"
14 git config --global user.email "jenkins-opnfv-ci@opnfv.org"
15
16 # Ensure we are able to generate Commit-IDs for new patchsets
17 curl -kLo .git/hooks/commit-msg https://gerrit.opnfv.org/gerrit/tools/hooks/commit-msg
18 chmod +x .git/hooks/commit-msg
19
20 # Activate virtualenv, supressing shellcheck warning
21 # shellcheck source=/dev/null
22 . $WORKSPACE/venv/bin/activate
23 pip install -r releases/scripts/requirements.txt
24
25 STREAM=${STREAM:-'nostream'}
26 RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM")
27
28 for release_file in $RELEASE_FILES; do
29     python releases/scripts/create_branch.py -f $release_file
30     python releases/scripts/create_jobs.py -f $release_file
31     NEW_FILES=$(git status --porcelain --untracked=no | cut -c4-)
32     if [ -n "$NEW_FILES" ]; then
33       git add $NEW_FILES
34       git commit -sm "Create Stable Branch Jobs for $(basename $release_file .yaml)"
35       git push origin HEAD:refs/for/master
36     fi
37 done