diff --git a/.travis.yml b/.travis.yml index 05643350..d0d9fdc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,4 +19,4 @@ script: - mkdir -p $GOPATH/src/github.com/nokia/danm/ - mv * $GOPATH/src/github.com/nokia/danm/ - cd $GOPATH/src/github.com/nokia/danm/ - - sudo ./build_danm.sh \ No newline at end of file + - ./build_danm.sh \ No newline at end of file diff --git a/.travis/install_buildah.sh b/.travis/install_buildah.sh index 3654e391..ec44fba8 100755 --- a/.travis/install_buildah.sh +++ b/.travis/install_buildah.sh @@ -1,8 +1,6 @@ #!/bin/bash if [[ $WITH_BUILDAH == 'Y' ]]; then - - sudo rm -f "$(command -v docker)" sudo apt-get -y install software-properties-common sudo add-apt-repository -y ppa:alexlarsson/flatpak @@ -29,15 +27,4 @@ if [[ $WITH_BUILDAH == 'Y' ]]; then EOF - sudo apt-get -y install libprotobuf-dev libprotobuf-c0-dev python3-setuptools - git clone https://github.com/kubernetes-sigs/cri-o "$GOPATH/src/github.com/kubernetes-sigs/cri-o" - cd "$GOPATH/src/github.com/kubernetes-sigs/cri-o" || exit - mkdir bin - make bin/conmon - sudo install -D -m 755 bin/conmon /usr/libexec/podman/conmon - - git clone https://github.com/containers/libpod/ "$GOPATH/src/github.com/containers/libpod" - cd "$GOPATH/src/github.com/containers/libpod" || exit - make - sudo make install PREFIX=/usr fi \ No newline at end of file diff --git a/build_buildah.sh b/build_buildah.sh index cadc8ef1..8eee6b6e 100644 --- a/build_buildah.sh +++ b/build_buildah.sh @@ -4,7 +4,9 @@ echo 'Building DANM builder container' buildah bud --no-cache -t danm_builder:1.0 build/ echo 'Running DANM build' -podman run --rm=true --net=host --name="danm_build" -v $GOPATH/bin:/go/bin -v $GOPATH/src:/go/src danm_builder:1.0 +build_container=$(buildah from danm_builder:1.0) +buildah run --net=host -v $GOPATH/bin:/go/bin -v $GOPATH/src:/go/src $build_container /bin/sh -c /build.sh +buildah rm $build_container echo 'Cleaning up DANM builder container' buildah rmi -f danm_builder:1.0 diff --git a/build_danm.sh b/build_danm.sh index 4c8e49f8..a6f0b5d5 100755 --- a/build_danm.sh +++ b/build_danm.sh @@ -30,10 +30,10 @@ error_handler() exit $1 } -if [ -x "$(command -v docker)" ]; then - source ./build_docker.sh -elif [ -x "$(command -v buildah)" ] && [ -x "$(command -v podman)" ]; then +if [ -x "$(command -v buildah)" ]; then source ./build_buildah.sh +elif [ -x "$(command -v docker)" ]; then + source ./build_docker.sh else echo 'The build process requires docker or buildah/podman installed. Please install any of these and make sure these are executable' exit 1