Skip to content

Commit a3fe210

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

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
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: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ readonly REPO_ROOT_DIR
1010
function build_transform_jsonata_image() {
1111
local image="${KO_DOCKER_REPO}/transform-jsonata:${TAG}"
1212

13-
docker buildx build \
14-
--platform linux/amd64,linux/arm64 \
13+
docker build \
14+
--platform "linux/amd64" \
15+
--platform "linux/arm64" \
1516
-t "${image}" \
1617
-f "${REPO_ROOT_DIR}/transform-jsonata/Dockerfile" \
17-
--push \
1818
"${REPO_ROOT_DIR}/transform-jsonata" || return $?
1919

2020

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

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)