blob: 4d4f28e27e159e2e9cb92fff6f6deee00916a727 [file] [log] [blame]
Andreas Wundsam77d04252013-11-20 11:02:45 -08001#!/bin/bash -eu
Andreas Wundsamd0b06f42013-11-19 17:18:14 -08002
3# Push the loxigen artifacts to a dedicated git repository,
4# along with a nice commit message and a tag
5
6ARTIFACT_REPO_URL="$1"
7if [[ ! $ARTIFACT_REPO_URL ]]; then
8 echo "Call syntax: $0 <artifact_repo_url>" >&2
9 exit 1
10fi
11
Andreas Wundsam77d04252013-11-20 11:02:45 -080012ARTIFACT_REPO=$(mktemp -d --tmpdir "push-artifacts-repo.XXXXXXX")
Andreas Wundsamd0b06f42013-11-19 17:18:14 -080013
14git clone ${ARTIFACT_REPO_URL} ${ARTIFACT_REPO}
Andreas Wundsam77d04252013-11-20 11:02:45 -080015find ${ARTIFACT_REPO} -mindepth 1 -maxdepth 1 -type d \! -name '.*' -print0 | xargs -0 rm -r
Andreas Wundsamd0b06f42013-11-19 17:18:14 -080016make LOXI_OUTPUT_DIR=${ARTIFACT_REPO} clean all
17
Andreas Wundsamd0b06f42013-11-19 17:18:14 -080018loxi_head=$(git rev-parse HEAD)
19last_loxi_log=$(git log --format=oneline -1)
Andreas Wundsam77d04252013-11-20 11:02:45 -080020git_log_file=$(mktemp --tmpdir "git-log-file.XXXXXXX")
21
22if [[ -e "${ARTIFACT_REPO}/loxi-revision" ]]; then
23 last_loxi_revision=$(cat "${ARTIFACT_REPO}/loxi-revision" | cut -d ' ' -f 1)
Andreas Wundsamd0b06f42013-11-19 17:18:14 -080024 echo "Last loxi revision committed: $last_loxi_revision"
25 git log $last_loxi_revision..HEAD >>$git_log_file
26 loxi_github_url="https://github.com/floodlight/loxigen/compare/${last_loxi_revision}...${loxi_head}"
27else
28 echo "No Previous loxi revision info found"
29 git log -1 HEAD >>$git_log_file
30 loxi_github_url="https://github.com/floodlight/loxigen/commit/${loxi_head}"
31fi
32
33
34(
35 set -xe
36 cd $ARTIFACT_REPO
37 echo $last_loxi_log >loxi-revision
38 git add -A
39
40 (
41 echo "Artifacts from ${loxi_github_url}"
42 echo
Andreas Wundsam77d04252013-11-20 11:02:45 -080043 echo "Loxigen Head commit floodlight/loxigen@${loxi_head}"
Andreas Wundsamd0b06f42013-11-19 17:18:14 -080044 cat $git_log_file
45 ) | git commit --file=-
46
47 git tag -a -f "loxi/${loxi_head}" -m "Tag Loxigen Revision ${loxi_head}"
48 git push
49)
50
51rm -rf ${ARTIFACT_REPO}