Skip to content

Commit

Permalink
chore: use fixed default runtime version
Browse files Browse the repository at this point in the history
As we now don't depend on the runtime directly, it makes sense to use a final release instead of a snapshot.
  • Loading branch information
squakez committed Jul 11, 2023
1 parent f6f18e4 commit c928e48
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 22 deletions.
2 changes: 2 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ RUN ${MVNW_DIR}/mvnw --version | grep "Maven home:" | sed 's/Maven home: //' >>
ENV MAVEN_OPTS="${MAVEN_OPTS} -Dlogback.configurationFile=${MAVEN_HOME}/conf/logback.xml"

ADD build/_maven_output ${MVN_REPO}
# Fix https://github.com/moby/moby/issues/37965
RUN true
ADD build/_kamelets /kamelets

RUN chgrp -R 0 ${MVN_REPO} \
Expand Down
33 changes: 22 additions & 11 deletions pkg/controller/catalog/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func initializeSpectrum(options spectrum.Options, ip *v1.IntegrationPlatform, ca
return target, nil
}

// nolint: maintidx // TODO: refactor the code
func initializeS2i(ctx context.Context, c client.Client, ip *v1.IntegrationPlatform, catalog *v1.CamelCatalog) (*v1.CamelCatalog, error) {
target := catalog.DeepCopy()
// No registry in s2i
Expand All @@ -180,14 +181,18 @@ func initializeS2i(ctx context.Context, c client.Client, ip *v1.IntegrationPlatf

uidStr := getS2iUserID(ctx, c, ip, catalog)

// Dockfile
dockerfile := string([]byte(`
// Dockerfile
dockerfile := `
FROM ` + catalog.Spec.GetQuarkusToolingImage() + `
USER ` + uidStr + `:0
ADD --chown=` + uidStr + `:0 /usr/local/bin/kamel /usr/local/bin/kamel
ADD --chown=` + uidStr + `:0 /usr/share/maven/mvnw/ /usr/share/maven/mvnw/
`
if imageSnapshot(imageName + ":" + imageTag) {
dockerfile = dockerfile + `
ADD --chown=` + uidStr + `:0 ` + defaults.LocalRepository + ` ` + defaults.LocalRepository + `
`))
`
}

owner := catalogReference(catalog)

Expand Down Expand Up @@ -294,12 +299,15 @@ func initializeS2i(ctx context.Context, c client.Client, ip *v1.IntegrationPlatf
return fmt.Errorf("cannot create tar archive: %w", err)
}

err = tarEntries(archiveFile,
directories := []string{
"/usr/local/bin/kamel:/usr/local/bin/kamel",
"/usr/share/maven/mvnw/:/usr/share/maven/mvnw/",
// Required for snapshots dependencies in the runtimes
defaults.LocalRepository+":"+defaults.LocalRepository,
)
}
if imageSnapshot(imageName + ":" + imageTag) {
directories = append(directories, defaults.LocalRepository+":"+defaults.LocalRepository)
}

err = tarEntries(archiveFile, directories...)
if err != nil {
return fmt.Errorf("cannot tar path entry: %w", err)
}
Expand Down Expand Up @@ -459,12 +467,15 @@ func buildRuntimeBuilderImageSpectrum(options spectrum.Options) error {
options.Jobs = jobs
}

_, err := spectrum.Build(options,
directories := []string{
"/usr/local/bin/kamel:/usr/local/bin/",
"/usr/share/maven/mvnw/:/usr/share/maven/mvnw/",
// Required for snapshots dependencies in the runtimes
defaults.LocalRepository+":"+defaults.LocalRepository,
)
}
if imageSnapshot(options.Target) {
directories = append(directories, defaults.LocalRepository+":"+defaults.LocalRepository)
}

_, err := spectrum.Build(options, directories...)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
Version = "2.0.0-SNAPSHOT"

// DefaultRuntimeVersion --
DefaultRuntimeVersion = "2.16.0-SNAPSHOT"
DefaultRuntimeVersion = "2.16.0"

// BuildahVersion --
BuildahVersion = "1.30.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
apiVersion: camel.apache.org/v1
kind: CamelCatalog
metadata:
name: camel-catalog-2.16.0-snapshot
name: camel-catalog-2.16.0
labels:
app: camel-k
camel.apache.org/catalog.loader.version: 3.20.1
camel.apache.org/catalog.version: 3.20.1
camel.apache.org/runtime.version: 2.16.0-SNAPSHOT
camel.apache.org/runtime.version: 2.16.0
spec:
runtime:
version: 2.16.0-SNAPSHOT
version: 2.16.0
provider: quarkus
applicationClass: io.quarkus.bootstrap.runner.QuarkusEntryPoint
metadata:
Expand Down
12 changes: 6 additions & 6 deletions script/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ VERSIONFILE := pkg/util/defaults/defaults.go
VERSION ?= 2.0.0-SNAPSHOT
LAST_RELEASED_IMAGE_NAME := camel-k-operator
LAST_RELEASED_VERSION ?= 1.12.1
RUNTIME_VERSION := 2.16.0-SNAPSHOT
DEFAULT_RUNTIME_VERSION := 2.16.0
BUILDAH_VERSION := 1.30.0
KANIKO_VERSION := 1.9.1
CONTROLLER_GEN_VERSION := v0.6.1
Expand Down Expand Up @@ -179,7 +179,7 @@ codegen:
@echo " Version = \"$(CUSTOM_VERSION)\"" >> $(VERSIONFILE)
@echo "" >> $(VERSIONFILE)
@echo " // DefaultRuntimeVersion -- " >> $(VERSIONFILE)
@echo " DefaultRuntimeVersion = \"$(RUNTIME_VERSION)\"" >> $(VERSIONFILE)
@echo " DefaultRuntimeVersion = \"$(DEFAULT_RUNTIME_VERSION)\"" >> $(VERSIONFILE)
@echo "" >> $(VERSIONFILE)
@echo " // BuildahVersion -- " >> $(VERSIONFILE)
@echo " BuildahVersion = \"$(BUILDAH_VERSION)\"" >> $(VERSIONFILE)
Expand Down Expand Up @@ -348,7 +348,7 @@ build-kamel:
ln -sf build/_output/bin/kamel-$(IMAGE_ARCH) ./kamel

build-resources:
./script/get_catalog.sh $(RUNTIME_VERSION) $(STAGING_RUNTIME_REPO)
./script/get_catalog.sh $(DEFAULT_RUNTIME_VERSION) $(STAGING_RUNTIME_REPO)
go generate ./pkg/...

bundle-kamelets:
Expand Down Expand Up @@ -419,7 +419,7 @@ check-licenses:
maven-overlay:
@echo "####### Preparing maven dependencies bundle..."
mkdir -p build/_maven_overlay
./script/maven_overlay.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(RUNTIME_VERSION) build/_maven_overlay
./script/maven_overlay.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(DEFAULT_RUNTIME_VERSION) build/_maven_overlay

kamel-overlay:
mkdir -p build/_output/bin
Expand All @@ -444,8 +444,8 @@ ifneq ($(IMAGE_ARCH), amd64)
endif

images: build kamel-overlay maven-overlay bundle-kamelets
ifneq (,$(findstring SNAPSHOT,$(RUNTIME_VERSION)))
./script/package_maven_artifacts.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(RUNTIME_VERSION)
ifneq (,$(findstring SNAPSHOT,$(DEFAULT_RUNTIME_VERSION)))
./script/package_maven_artifacts.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(DEFAULT_RUNTIME_VERSION)
endif
@echo "####### Building Camel K operator arch $(IMAGE_ARCH) container image..."
mkdir -p build/_maven_output
Expand Down
2 changes: 1 addition & 1 deletion script/update_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
location=$(dirname $0)

echo "Scraping information from Makefile"
RUNTIME_VERSION=$(grep '^RUNTIME_VERSION := ' Makefile | sed 's/^.* \?= //')
RUNTIME_VERSION=$(grep '^DEFAULT_RUNTIME_VERSION := ' Makefile | sed 's/^.* \?= //')

CATALOG="$location/../resources/camel-catalog-$RUNTIME_VERSION.yaml"
# This script requires the catalog to be available (via make build-resources for instance)
Expand Down

0 comments on commit c928e48

Please sign in to comment.