Skip to content
This repository was archived by the owner on Sep 5, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 40 additions & 21 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,56 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o pipefail
# Load github.com/knative/test-infra/images/prow-tests/scripts/release.sh
[ -f /workspace/release.sh ] \
&& source /workspace/release.sh \
|| eval "$(docker run --entrypoint sh gcr.io/knative-tests/test-infra/prow-tests -c 'cat release.sh')"
[ -v KNATIVE_TEST_INFRA ] || exit 1

# Set default GCS/GCR
: ${BUILD_RELEASE_GCS:="build-crd"}
: ${BUILD_RELEASE_GCR:="gcr.io/build-crd"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these to where serving and eventing put their releases? Which I believe is knative-releases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can and I'm happy to do that, but last time I talked to @mattmoor about this, he wanted to keep them in separate GCRs. Matt?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

knative-releases seems fine. This was just trickier when it was elafros.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #276

readonly BUILD_RELEASE_GCS
readonly BUILD_RELEASE_GCR

# Local generated yaml file
readonly OUTPUT_YAML=release.yaml

source "$(dirname $(readlink -f ${BASH_SOURCE}))/../test/library.sh"
# Script entry point

function cleanup() {
restore_override_vars
}
parse_flags $@

cd ${BUILD_ROOT_DIR}
trap cleanup EXIT
set -o errexit
set -o pipefail

echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@@ RUNNING RELEASE VALIDATION TESTS @@@@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
run_validation_tests ./test/presubmit-tests.sh

# Run tests.
./test/presubmit-tests.sh
banner "Building the release"

echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@@ BUILDING THE RELEASE @@@@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
# Set the repository
export KO_DOCKER_REPO=${BUILD_RELEASE_GCR}
# 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

# Set the repository to the official one:
export KO_DOCKER_REPO=gcr.io/build-crd
if (( PUBLISH_RELEASE )); then
echo "- Destination GCR: ${BUILD_RELEASE_GCR}"
echo "- Destination GCS: ${BUILD_RELEASE_GCS}"
fi

echo "Building build-crd"
ko resolve -P -f config/ > release.yaml
ko resolve ${KO_FLAGS} -P -f config/ > ${OUTPUT_YAML}
tag_images_in_yaml ${OUTPUT_YAML} ${BUILD_RELEASE_GCR} ${TAG}

echo "New release built successfully"

if (( ! PUBLISH_RELEASE )); then
exit 0
fi

echo "Publishing release.yaml"
gsutil cp release.yaml gs://build-crd/latest/release.yaml
echo "Publishing ${OUTPUT_YAML}"
publish_yaml ${OUTPUT_YAML} ${BUILD_RELEASE_GCS} ${TAG}

echo "New release published successfully"

Expand Down