aboutsummaryrefslogtreecommitdiff
path: root/lt-qcom-linux-automerge-repo-manifest/builders.sh
blob: 7124877bb14fa9f31759b9eee236749860eee847 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

set -ex

git config --global user.name "Linaro CI"
git config --global user.email "ci_notify@linaro.org"
git config --global core.sshCommand "ssh -F ${HOME}/qcom.sshconfig"

cat << EOF > ${HOME}/qcom.sshconfig
Host git.linaro.org
    User git
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
EOF
chmod 0600 ${HOME}/qcom.sshconfig

QCOMLT_CONFIG_PATH=${PWD}/$(basename ${QCOMLT_CONFIG_REPO_URL})
git clone -v ${QCOMLT_CONFIG_REPO_URL} ${QCOMLT_CONFIG_PATH}

cd ${QCOMLT_CONFIG_PATH}
CURRENT_REVISION=$(git rev-parse --short HEAD)
python ./bin/automerge2repo.py automerge-ci.conf automerge-ci.xml
git add automerge-ci.xml

git commit -s -m "automerge-ci.xml: Update based on rev ${CURRENT_REVISION}" automerge-ci.xml
set +e
diff_msg=$(git diff HEAD..origin/${QCOMLT_CONFIG_BRANCH} -- automerge-ci.xml)
diff_status=$?
set -e

# only commit when is not branch previously created or a change exists into automerge-ci.xml
if [ $diff_status -ne 0 ] || [ ! -z "$diff_msg" ]; then
	echo "Pusing new version of automerge-ci.xml to ${QCOMLT_CONFIG_REPO_URL} ${QCOMLT_CONFIG_BRANCH}..."
	git push ${QCOMLT_CONFIG_REPO_URL} master:${QCOMLT_CONFIG_BRANCH} -f
fi

exit 0