Skip to content

Commit 8ae76bc

Browse files
committed
Add build tests
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
1 parent de31c89 commit 8ae76bc

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

hack/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
source "$(dirname $0)/common.sh"
44

5+
export KO_DOCKER_REPO="${KO_DOCKER_REPO:-kind.local}"
6+
57
build_transform_jsonata_image || exit 1
8+
9+
build_integration_images || exit 1

hack/common.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ readonly REPO_ROOT_DIR
1010
function build_transform_jsonata_image() {
1111
local image="${KO_DOCKER_REPO}/transform-jsonata:${TAG}"
1212

13-
docker buildx build \
13+
docker build \
1414
--platform linux/amd64,linux/arm64 \
1515
-t "${image}" \
1616
-f "${REPO_ROOT_DIR}/transform-jsonata/Dockerfile" \
17-
--push \
1817
"${REPO_ROOT_DIR}/transform-jsonata" || return $?
1918

2019

2120
TRANSFORM_JSONATA_IMAGE=$(docker inspect --format '{{index .RepoDigests 0}}' "${image}")
2221
export TRANSFORM_JSONATA_IMAGE
2322
}
23+
24+
function push_transform_jsonata_image() {
25+
docker push "${TRANSFORM_JSONATA_IMAGE}"
26+
}
27+
28+
function build_integration_images() {
29+
"${REPO_ROOT_DIR}/mvnw" clean package -P knative -DskipTests || return $?
30+
}

hack/release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ function build_release() {
2727

2828
# KO_DOCKER_REPO and TAG are calculated in release.sh script
2929

30-
./mvnw clean package -P knative -DskipTests || return $?
30+
build_integration_images || return $?
3131

3232
# use the function so that the exported TRANSFORM_JSONATA_IMAGE is visible after during generate_transformation_configMap
3333
build_transform_jsonata_image || return $?
34+
push_transform_jsonata_image || return $?
3435

3536
echo "Image build & push completed"
3637

test/presubmit-tests.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/usr/bin/env bash
22

3-
# TODO a placeholder script to CI automation.
4-
# Can be used to execute integration tests in the future.
3+
# shellcheck disable=SC1090
4+
source "$(go run knative.dev/hack/cmd/script presubmit-tests.sh)"
5+
source "$(go run knative.dev/hack/cmd/script infra-library.sh)"
56

6-
./hack/build.sh
7+
function build_tests() {
8+
header "Running build tests"
9+
./hack/build.sh || fail_test "build tests failed"
10+
}
711

8-
true
12+
main $@

0 commit comments

Comments
 (0)