Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| summary: Mirror snapd adding go dependencies | |
| environment: | |
| TARGET_DIR: $GOPATH/src/snapd-plus-vendor-target | |
| prepare: | | |
| mv id_rsa /tmp | |
| mv cookies.txt /tmp | |
| sysctl -w net.ipv6.conf.all.disable_ipv6=1 | |
| trap "sysctl -w net.ipv6.conf.all.disable_ipv6=0" EXIT | |
| apt update && apt install -y git golang-1.6 openssh-client jq | |
| go get -u github.com/kardianos/govendor | |
| chmod 0600 /tmp/id_rsa | |
| restore: | | |
| rm -f /tmp/id_rsa /tmp/cookies.txt | |
| rm -rf origin $TARGET_DIR | |
| apt remove -y git golang-1.6 openssh-client jq | |
| execute: | | |
| # get origin merge commit | |
| . ./options | |
| build_number=$(echo "$TRAVIS_COMMIT_MESSAGE" | sed -e "s/$message (\(.*\))/\1/") | |
| origin_commit=$(curl -s https://api.travis-ci.org/repos/snapcore/snapd/builds?number=$build_number | jq -j '.[0].commit') | |
| # clone origin repo and prepare for getting vendor dependencies | |
| git clone https://github.com/snapcore/snapd origin | |
| cd origin | |
| if [ -n "$origin_commit" ] && [ "$origin_commit" != null]; then | |
| git reset --hard $origin_commit | |
| fi | |
| rm -rf .git | |
| sed -i 's|^vendor/\*/$||' .gitignore | |
| cd .. | |
| # clone target repo and copy origin over target | |
| eval `ssh-agent -s` | |
| mkdir -p ${HOME}/.ssh && ssh-keyscan -t rsa git.launchpad.net >> ~/.ssh/known_hosts | |
| ssh-agent $(ssh-add /tmp/id_rsa; git clone git+ssh://snappy-m-o@git.launchpad.net/snapd-vendor /tmp/$TARGET_DIR) | |
| mkdir -p $TARGET_DIR && mv /tmp/$TARGET_DIR/.git $TARGET_DIR && rm -rf /tmp/$TARGET_DIR | |
| cp -ar origin/. $TARGET_DIR | |
| # configure git locally | |
| cd $TARGET_DIR | |
| git config user.name "Snappy Developers" | |
| git config user.email snappy-dev@lists.launchpad.net | |
| # get vendor dependencies on target repo | |
| govendor sync | |
| if [ $(git ls-files -dmo | wc -l) != "0" ]; then | |
| # add the commit information | |
| echo "master:$origin_commit" >> commits | |
| # if something was deleted, changed or added commit and push to the target repo | |
| git add . | |
| # guard against commited and later ignored files.. | |
| if git commit -am"Content updated ($origin_commit)"; then | |
| ssh-agent $(ssh-add /tmp/id_rsa; git push) | |
| # trigger build | |
| for suffix in "" "-zesty" "-artful" "-trusty"; do | |
| curl -X POST -v -b /tmp/cookies.txt \ | |
| --referer https://code.launchpad.net/~snappy-dev/+recipe/snapd-vendor-daily${suffix}/ \ | |
| -d 'field.archive=%7Esnappy-dev%2Fubuntu%2Fedge&field.distroseries=269&field.distroseries-empty-marker=1&field.archive-empty-marker=1&field.actions.request=Request+builds' \ | |
| https://code.launchpad.net/~snappy-dev/+recipe/snapd-vendor-daily${suffix}/+request-builds | |
| done | |
| fi | |
| fi |