Skip to content

Commit

Permalink
Build and use base image for creds-init and git-init
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh committed Dec 10, 2018
1 parent fb108df commit 0c3ced9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
baseImageOverrides:
github.com/knative/build-pipeline/vendor/github.com/knative/build/cmd/creds-init: gcr.io/knative-releases/github.com/knative/build-pipeline/build-base:latest
github.com/knative/build-pipeline/vendor/github.com/knative/build/cmd/git-init: gcr.io/knative-releases/github.com/knative/build-pipeline/build-base:latest
3 changes: 3 additions & 0 deletions .ko.yaml.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
baseImageOverrides:
github.com/knative/build-pipeline/vendor/github.com/knative/build/cmd/creds-init: gcr.io/knative-release/github.com/knative/build-pipeline/build-base:latest
github.com/knative/build-pipeline/vendor/github.com/knative/build/cmd/git-init: gcr.io/knative-release/github.com/knative/build-pipeline/build-base:latest
33 changes: 19 additions & 14 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,40 @@

source $(dirname $0)/../vendor/github.com/knative/test-infra/scripts/release.sh

# Set default GCS/GCR
: ${BUILD_PIPELINE_RELEASE_GCS:="knative-nightly/build-pipeline"}
: ${BUILD_PIPELINE_RELEASE_GCR:="gcr.io/knative-nightly"}
readonly BUILD_PIPELINE_RELEASE_GCS
readonly BUILD_PIPELINE_RELEASE_GCR

# Local generated yaml file
readonly OUTPUT_YAML=release.yaml

# Set the repository
export KO_DOCKER_REPO=${BUILD_PIPELINE_RELEASE_GCR}

# Script entry point

initialize $@

set -o errexit
set -o pipefail

# When building a versioned release, we must use .ko.yaml.release
if (( BRANCH_RELEASE )); then
# KO_CONFIG_PATH expects a path containing a .ko.yaml file
export KO_CONFIG_PATH="$(mktemp -d)"
cp .ko.yaml.release "${KO_CONFIG_PATH}/.ko.yaml"
echo "- Using .ko.yaml.release for base image overrides"
fi

run_validation_tests ./test/presubmit-tests.sh

# Build the release

banner "Building the release"

# Location of the base image for creds-init and git images
readonly BUILD_BASE_GCR="${KO_DOCKER_REPO}/github.com/knative/build-pipeline/build-base"

# Build should not try to deploy anything, use a bogus value for cluster.
export K8S_CLUSTER_OVERRIDE=CLUSTER_NOT_SET
export K8S_USER_OVERRIDE=USER_NOT_SET
export DOCKER_REPO_OVERRIDE=DOCKER_NOT_SET

echo "- Destination GCR: ${KO_DOCKER_REPO}"
if (( PUBLISH_RELEASE )); then
echo "- Destination GCS: ${BUILD_PIPELINE_RELEASE_GCS}"
fi
# Build the base image for creds-init and git images.
docker build -t ${BUILD_BASE_GCR} -f images/Dockerfile images/

echo "Building build-pipeline"
ko resolve ${KO_FLAGS} -f config/ > ${OUTPUT_YAML}
Expand All @@ -59,7 +61,10 @@ if (( ! PUBLISH_RELEASE )); then
exit 0
fi

echo "Publishing ${OUTPUT_YAML}"
# Push the base image for creds-init and git images.
echo "Pushing base images to ${BUILD_BASE_GCR}"
docker push ${BUILD_BASE_GCR}

publish_yaml ${OUTPUT_YAML} ${BUILD_PIPELINE_RELEASE_GCS} ${TAG}

branch_release "Knative Build Pipeline" "${OUTPUT_YAML}"
Expand Down

0 comments on commit 0c3ced9

Please sign in to comment.