Skip to content

Commit

Permalink
Merge pull request #25 from dhiller/passthrough-dry-run-next
Browse files Browse the repository at this point in the history
Passthrough dry-run, replace image scripts with Makefile, move to quay
  • Loading branch information
dhiller authored Nov 18, 2020
2 parents e78ac0d + 035be62 commit a0cd924
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 59 deletions.
2 changes: 2 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ filters:
- stu-gott
- danielBelenky
- dhiller
- fgimenez
approvers:
- rmohr
- stu-gott
- danielBelenky
- dhiller
- fgimenez
30 changes: 30 additions & 0 deletions images/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
REPO?=quay.io/kubevirtci
TAG?=latest
BUILDER_IMAGE_NAME=kubectl-virt-builder
TEST_INSTALL_IMAGE_NAME=kubectl-krew
CONTAINER_ENGINE?=docker

all: update_image_sha

.PHONY: build_builder
build_builder:
$(CONTAINER_ENGINE) build . -f builder/Dockerfile -t $(REPO)/$(BUILDER_IMAGE_NAME):$(TAG)

.PHONY: push_builder
push_builder: build_builder
$(CONTAINER_ENGINE) push $(REPO)/$(BUILDER_IMAGE_NAME):$(TAG)

.PHONY: build_test_install
build_test_install:
$(CONTAINER_ENGINE) build . -f test_install/Dockerfile -t $(REPO)/$(TEST_INSTALL_IMAGE_NAME):$(TAG)

.PHONY: push_test_install
push_test_install: build_builder build_test_install
$(CONTAINER_ENGINE) push $(REPO)/$(TEST_INSTALL_IMAGE_NAME):$(TAG)

.PHONY: push_all
push_all: push_builder push_test_install

.PHONY: update_image_sha
update_image_sha: push_all
./update-image-sha.sh $(REPO)/$(TEST_INSTALL_IMAGE_NAME)
7 changes: 0 additions & 7 deletions images/build-and-publish-all.sh

This file was deleted.

7 changes: 0 additions & 7 deletions images/build.sh

This file was deleted.

3 changes: 0 additions & 3 deletions images/builder/config.sh

This file was deleted.

8 changes: 0 additions & 8 deletions images/common.sh

This file was deleted.

7 changes: 0 additions & 7 deletions images/publish.sh

This file was deleted.

3 changes: 0 additions & 3 deletions images/test_install/config.sh

This file was deleted.

9 changes: 3 additions & 6 deletions images/update-image-sha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

set -xeuo pipefail

set -xeuo pipefail

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

docker pull ${IMAGE_NAME}
sha_id=$(docker images --digests ${IMAGE_NAME} | grep 'latest ' | awk '{ print $3 }')
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/create-github-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

[ "$#" -eq 0 ] && usage "version must be provided!"
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-krew-index-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

[ "$#" -eq 0 ] && usage "version must be provided!"
Expand Down
4 changes: 2 additions & 2 deletions scripts/create-krew-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

[ "$#" -eq 0 ] && usage "version must be provided!"
[ -z "$1" ] && usage "version must be provided!"

create_krew_manifest_yaml "$1"
create_krew_manifest_yaml "$1"
12 changes: 9 additions & 3 deletions scripts/create-latest-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DRY_RUN=""
for i in "$@"; do
case $i in
-d | --dry-run)
DRY_RUN="$i"
DRY_RUN="$1"
shift
;;
-h | --help)
Expand Down Expand Up @@ -69,5 +69,11 @@ fi

echo "Preparing packages for release $KUBEVIRT_RELEASE_VERSION..."

# shellcheck source=scripts/functions.sh
"$(dirname "${BASH_SOURCE[0]}")/create-release.sh" "$DRY_RUN" "$KUBEVIRT_RELEASE_VERSION"
args="$KUBEVIRT_RELEASE_VERSION"
if [ -n "$DRY_RUN" ]; then
args="$DRY_RUN $args"
fi

# shellcheck source=scripts/create-release.sh
# shellcheck disable=SC2086
"$(dirname "${BASH_SOURCE[0]}")/create-release.sh" ${args}
4 changes: 2 additions & 2 deletions scripts/create-pull-request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

echo -e "\nCreating pull request:"
echo $(create_pull_request "$1")
create_pull_request "$1"
4 changes: 2 additions & 2 deletions scripts/create-release-packages.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

[ "$#" -eq 0 ] && usage "version must be provided!"
[ -z "$1" ] && usage "version must be provided!"

create_release_packages "$1"
create_release_packages "$1"
2 changes: 1 addition & 1 deletion scripts/create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

function usage() {
Expand Down
4 changes: 2 additions & 2 deletions scripts/download-virtctl-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

[ "$#" -eq 0 ] && usage "version must be provided!"
[ -z "$1" ] && usage "version must be provided!"

echo "$(download_virtctl_binaries "$@")"
download_virtctl_binaries "$@"
4 changes: 2 additions & 2 deletions 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:c70cfa939876c8a8247c9d8c39e1adf5840024ac6b4eb6f21f6cd117e4e700da \
quay.io/kubevirtci/kubectl-krew@sha256:38945afd781e8301f3390ff3d6f48539831533ce5fdc8707a5ceaff948245d6d \
kubectl krew install --manifest=/virt_package/virt.yaml --archive=/virt_package/virtctl.tar.gz >test.log 2>&1
result=$?
set -e
Expand Down Expand Up @@ -311,7 +311,7 @@ function get_github_auth() {
}

function get_github_username() {
echo "dhiller"
echo "$GH_KUBECTL_VIRT_PLUGIN_USERNAME"
}

function get_github_token() {
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-krew-package-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -euo pipefail

# shellcheck source=scripts/functions.sh
# shellcheck source=scripts/functions
source "$(dirname "${BASH_SOURCE[0]}")/functions"

[ "$#" -eq 0 ] && usage "version must be provided!"
[ -z "$1" ] && usage "version must be provided!"

echo $(test_linux_install_on_docker "$1")
test_linux_install_on_docker "$1"

0 comments on commit a0cd924

Please sign in to comment.