-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add build tests #67
Merged
Merged
Add build tests #67
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e35b07e
Add build tests
pierDipi 0571a22
Fix dockerfile
pierDipi cc35262
Manual multi arch builds
pierDipi 76f44a2
Build works
pierDipi f50df93
Move to npm CLI
pierDipi bcf4237
Back to buildx
pierDipi 3af2327
Run binfmt installation
pierDipi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,63 @@ set -euo pipefail | |
|
||
export TAG=${TAG:-$(git rev-parse HEAD)} | ||
|
||
export TRANSFORM_JSONATA_IMAGE_WITH_TAG="${KO_DOCKER_REPO:-kind.local}/transform-jsonata:${TAG}" | ||
|
||
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)" | ||
readonly REPO_ROOT_DIR | ||
|
||
export TRANSFORM_JSONATA_DIR="${REPO_ROOT_DIR}/transform-jsonata" | ||
|
||
|
||
function build_transform_jsonata_image() { | ||
local image="${KO_DOCKER_REPO}/transform-jsonata:${TAG}" | ||
|
||
if (( ${IS_PROW:-0} )); then | ||
docker run --privileged --rm tonistiigi/binfmt --install all binfmt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's the multi-arch builder image? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's installing qemu packages so that docker buildx can emulate instructions for other platforms |
||
fi | ||
|
||
docker info | ||
docker buildx ls | ||
|
||
echo "Building image for arm64" | ||
docker buildx build \ | ||
--debug \ | ||
--pull \ | ||
-t "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}-arm64" \ | ||
-f "${REPO_ROOT_DIR}/transform-jsonata/Dockerfile" \ | ||
--platform "linux/arm64" \ | ||
"${REPO_ROOT_DIR}/transform-jsonata" \ | ||
|| return $? | ||
|
||
echo "Building image for amd64" | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
-t "${image}" \ | ||
--debug \ | ||
--pull \ | ||
-t "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}-amd64" \ | ||
-f "${REPO_ROOT_DIR}/transform-jsonata/Dockerfile" \ | ||
--push \ | ||
"${REPO_ROOT_DIR}/transform-jsonata" || return $? | ||
--platform "linux/amd64" \ | ||
"${REPO_ROOT_DIR}/transform-jsonata" \ | ||
|| return $? | ||
} | ||
|
||
function push_transform_jsonata_image() { | ||
docker push "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}-amd64" || return $? | ||
docker push "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}-arm64" || return $? | ||
|
||
echo "Creating manifest ${TRANSFORM_JSONATA_IMAGE_WITH_TAG}" | ||
docker manifest create --amend "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}" \ | ||
"${TRANSFORM_JSONATA_IMAGE_WITH_TAG}-amd64" \ | ||
"${TRANSFORM_JSONATA_IMAGE_WITH_TAG}-arm64" || return $? | ||
|
||
echo "Pushing manifest ${TRANSFORM_JSONATA_IMAGE_WITH_TAG}" | ||
docker manifest push "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}" || return $? | ||
|
||
digest=$(docker buildx imagetools inspect "${TRANSFORM_JSONATA_IMAGE_WITH_TAG}" --format "{{json .Manifest.Digest }}" | tr -d '"') | ||
TRANSFORM_JSONATA_IMAGE="${TRANSFORM_JSONATA_IMAGE_WITH_TAG}@${digest}" | ||
export TRANSFORM_JSONATA_IMAGE | ||
|
||
echo "TRANSFORM_JSONATA_IMAGE=${TRANSFORM_JSONATA_IMAGE}" | ||
} | ||
|
||
TRANSFORM_JSONATA_IMAGE=$(docker inspect --format '{{index .RepoDigests 0}}' "${image}") | ||
export TRANSFORM_JSONATA_IMAGE | ||
function build_integration_images() { | ||
"${REPO_ROOT_DIR}/mvnw" clean package -P knative -DskipTests || return $? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
# TODO a placeholder script to CI automation. | ||
# Can be used to execute integration tests in the future. | ||
# shellcheck disable=SC1090 | ||
source "$(go run knative.dev/hack/cmd/script presubmit-tests.sh)" | ||
|
||
./hack/build.sh | ||
function build_tests() { | ||
header "Running build tests" | ||
export IS_PROW | ||
./hack/build.sh || fail_test "build tests failed" | ||
} | ||
|
||
true | ||
main $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the integration images build is trying to push to
KO_DOCKER_REPO
, so we can enable them later when we figure this out