Skip to content

Instantly share code, notes, and snippets.

@lslezak
Last active June 2, 2017 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lslezak/f32475f8b8724a1886d05cac4649065a to your computer and use it in GitHub Desktop.
Save lslezak/f32475f8b8724a1886d05cac4649065a to your computer and use it in GitHub Desktop.
Automate Docker Support for SP2
#!/bin/sh
# This script adds Docker support for the SP2 branches,
# see https://trello.com/c/V0OaC4DT.
#
# - Run it in an YaST repo checkout.
# - Check the diff displayed in the browser
# - Wait for the Travis results
# - Debug/fix the issues manually if it does not build
set -e -x
# setup the branch
git checkout SLE-12-SP2
git pull --rebase
git checkout -b Docker_SLE12-SP2
# copy the travis files from "master"
# the .gitignore update is usually needed for
git checkout master Dockerfile .travis.yml .gitignore
# use the SP2 Docker image
sed -i Dockerfile -e '/^FROM yastdevel/ s/$/:sle12-sp2/'
# add a debugging command (list packages)
DOCKER_IMAGE=`grep "docker build" .travis.yml | sed -e 's#.*docker build -t \(.*\) .*#\1#'`
sed -i "/docker build/a \ \ # list the installed packages (just for easier debugging)\n - docker run --rm -it $DOCKER_IMAGE rpm -qa | sort\n" .travis.yml
# publish the changes
git add .travis.yml Dockerfile
git commit -m "Use Docker at Travis also in the SLE12-SP2 branch"
git push --set-upstream origin Docker_SLE12-SP2
REPO=`git remote get-url origin | sed -e 's#^git@github.com:yast/\(.*\)\.git$#\1#'`
# create the PR in browser
xdg-open "https://github.com/yast/$REPO/compare/SLE-12-SP2...Docker_SLE12-SP2?expand=1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment