Skip to content

Commit 1c04ebe

Browse files
authored
Build and release transform-jsonata (#65)
- build for amd64, arm64 (for linux/s390x,linux/ppc64le, I'm getting a 400 error from Quay so skipping for now) - release a configmap with transform-specific image references (to be used in eventing core) Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
1 parent 74d1a38 commit 1c04ebe

File tree

6 files changed

+65
-8
lines changed

6 files changed

+65
-8
lines changed

hack/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
source "$(dirname $0)/common.sh"
4+
5+
build_transform_jsonata_image || exit 1

hack/common.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
export TAG=${TAG:-$(git rev-parse HEAD)}
6+
7+
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
8+
readonly REPO_ROOT_DIR
9+
10+
function build_transform_jsonata_image() {
11+
local image="${KO_DOCKER_REPO}/transform-jsonata:${TAG}"
12+
13+
docker buildx build \
14+
--platform linux/amd64,linux/arm64 \
15+
-t "${image}" \
16+
-f "${REPO_ROOT_DIR}/transform-jsonata/Dockerfile" \
17+
--push \
18+
"${REPO_ROOT_DIR}/transform-jsonata" || return $?
19+
20+
21+
TRANSFORM_JSONATA_IMAGE=$(docker inspect --format '{{index .RepoDigests 0}}' "${image}")
22+
export TRANSFORM_JSONATA_IMAGE
23+
}

hack/release.sh

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
# shellcheck disable=SC1090
1818
source "$(go run knative.dev/hack/cmd/script release.sh)"
19+
source "$(dirname $0)/common.sh"
1920

20-
CONFIMAP_YAML="eventing-integrations-images.yaml"
21+
INTEGRATION_CONFIGMAP_YAML="eventing-integrations-images.yaml"
22+
TRANSFORMATION_CONFIGMAP_YAML="eventing-transformations-images.yaml"
2123
IMAGES_TXT="images.txt"
2224

2325
function build_release() {
@@ -27,26 +29,50 @@ function build_release() {
2729

2830
./mvnw clean package -P knative -DskipTests || return $?
2931

32+
# use the function so that the exported TRANSFORM_JSONATA_IMAGE is visible after during generate_transformation_configMap
33+
build_transform_jsonata_image || return $?
34+
3035
echo "Image build & push completed"
3136

3237
echo "Collect image shas into ConfigMap"
33-
generate_configMap
38+
generate_integration_configMap || return $?
39+
generate_transformation_configMap || return $?
3440

35-
ARTIFACTS_TO_PUBLISH="${CONFIMAP_YAML} ${IMAGES_TXT}"
41+
ARTIFACTS_TO_PUBLISH="${INTEGRATION_CONFIGMAP_YAML} ${TRANSFORMATION_CONFIGMAP_YAML} ${IMAGES_TXT}"
3642
sha256sum ${ARTIFACTS_TO_PUBLISH} >checksums.txt
3743
ARTIFACTS_TO_PUBLISH="${ARTIFACTS_TO_PUBLISH} checksums.txt"
3844
echo "Checksum:"
3945
cat checksums.txt
4046
}
4147

42-
function generate_configMap() {
48+
49+
50+
function generate_transformation_configMap() {
51+
52+
cat <<EOF > ${TRANSFORMATION_CONFIGMAP_YAML}
53+
apiVersion: v1
54+
kind: ConfigMap
55+
metadata:
56+
name: eventing-transformations-images
57+
namespace: knative-eventing
58+
labels:
59+
app.kubernetes.io/version: "${TAG}"
60+
data:
61+
transform-jsonata: ${TRANSFORM_JSONATA_IMAGE}
62+
EOF
63+
}
64+
65+
function generate_integration_configMap() {
4366
image_digests=$(find . -name "jib-image.digest")
4467

45-
cat <<EOF > ${CONFIMAP_YAML}
68+
cat <<EOF > ${INTEGRATION_CONFIGMAP_YAML}
4669
apiVersion: v1
4770
kind: ConfigMap
4871
metadata:
4972
name: eventing-integrations-images
73+
namespace: knative-eventing
74+
labels:
75+
app.kubernetes.io/version: "${TAG}"
5076
data:
5177
EOF
5278

@@ -56,7 +82,7 @@ EOF
5682
image=$(echo "${image_digest_path}" | cut -d "/" -f2)
5783
image_digest=$(cat "${image_digest_path}")
5884
# Config map with key value imageName:imageRef
59-
echo " ${image}: ${KO_DOCKER_REPO}/${image}:${image_digest}" >>${CONFIMAP_YAML}
85+
echo " ${image}: ${KO_DOCKER_REPO}/${image}:${image_digest}" >>${INTEGRATION_CONFIGMAP_YAML}
6086
# Storing plain image URLs in a txt file
6187
echo "${KO_DOCKER_REPO}/${image}:${image_digest}" >>${IMAGES_TXT}
6288
done

test/presubmit-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
# TODO a placeholder script to CI automation.
44
# Can be used to execute integration tests in the future.
55

6+
./hack/build.sh
7+
68
true

transform-jsonata/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
examples
3+
README.md

transform-jsonata/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.access.redhat.com/ubi8/nodejs-20 AS builder
1+
FROM registry.access.redhat.com/ubi9/nodejs-20 AS builder
22

33
# Set working directory
44
WORKDIR /app
@@ -23,7 +23,7 @@ COPY . .
2323
RUN pnpm build || echo "No build step found, skipping"
2424

2525
# Use a minimal base image for runtime
26-
FROM registry.access.redhat.com/ubi8/nodejs-20
26+
FROM registry.access.redhat.com/ubi9/nodejs-20
2727

2828
ENV NODE_ENV=production
2929

0 commit comments

Comments
 (0)