Skip to content

Commit

Permalink
Merge pull request #23 from dhiller/create-builder-image
Browse files Browse the repository at this point in the history
Create builder image
  • Loading branch information
dhiller authored Sep 17, 2020
2 parents 4ab12ae + 8a22246 commit c0d099f
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 35 deletions.
7 changes: 7 additions & 0 deletions images/build-and-publish-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

images=("builder" "test_install")
for image in "${images[@]}"; do
./build.sh $image
./publish.sh $image
done
7 changes: 7 additions & 0 deletions images/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -xeuo pipefail

source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || exit 1)/common.sh"

docker build "$SCRIPT_DIR/$1" -t ${IMAGE_NAME}
22 changes: 22 additions & 0 deletions images/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM gcr.io/k8s-testimages/bootstrap:v20190516-c6832d9

RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-upgrade \
shellcheck \
gettext-base \
python3-pkg-resources \
yamllint

ENV GIMME_GO_VERSION=1.13.14

RUN mkdir -p /gimme && curl -sL \
https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | \
HOME=/gimme bash >> /etc/profile.d/gimme.sh

ENV GOPATH="/go" GOBIN="/usr/bin" GO111MODULE="on"

RUN set -x && \
. /etc/profile.d/gimme.sh && \
go get -v sigs.k8s.io/krew/cmd/[email protected] && \
go clean -cache -modcache && \
rm -rf /go && mkdir /go
3 changes: 3 additions & 0 deletions images/builder/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

IMAGE_NAME="dhiller/kubectl-virt-builder"
8 changes: 8 additions & 0 deletions images/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || exit 1)
BASE_DIR="${SCRIPT_DIR/\/kubectl-virt-plugin\/*/\/kubectl-virt-plugin}"

[ ! -d "$SCRIPT_DIR/$1/config.sh" ] || exit 1

source "$SCRIPT_DIR/$1/config.sh"
7 changes: 7 additions & 0 deletions images/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -xeuo pipefail

source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || exit 1)/common.sh"

docker push ${IMAGE_NAME}:latest
File renamed without changes.
3 changes: 3 additions & 0 deletions images/test_install/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

IMAGE_NAME="dhiller/kubectl-krew"
14 changes: 14 additions & 0 deletions images/update-image-sha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -xeuo pipefail

set -xeuo pipefail

source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || exit 1)/common.sh"

docker pull ${IMAGE_NAME}
sha_id=$(docker images --digests ${IMAGE_NAME} | grep 'latest ' | awk '{ print $3 }')
echo "sha: ${sha_id}"

sed -i -E 's#'"${IMAGE_NAME}"'@sha256\:[a-z0-9]+#'"${IMAGE_NAME}@$sha_id"'#g' ../scripts/functions

2 changes: 1 addition & 1 deletion scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function test_linux_install_on_docker() {

set +e
docker run --privileged --rm -v "$(pwd):/virt_package" \
dhiller/kubectl-krew@sha256:e8b04582601b7fe11afa5c9e15f4ed427835b4b99c2578fed16471d2d247167b \
dhiller/kubectl-krew@sha256:c70cfa939876c8a8247c9d8c39e1adf5840024ac6b4eb6f21f6cd117e4e700da \
kubectl krew install --manifest=/virt_package/virt.yaml --archive=/virt_package/virtctl.tar.gz >test.log 2>&1
result=$?
set -e
Expand Down
19 changes: 0 additions & 19 deletions scripts/publish-test-image.sh

This file was deleted.

15 changes: 0 additions & 15 deletions test_install/build-image.sh

This file was deleted.

0 comments on commit c0d099f

Please sign in to comment.