diff --git a/locations/templates/quarkus-application/manifests/helm/deploy/templates/_helpers.tpl b/locations/templates/quarkus-application/manifests/helm/deploy/templates/_helpers.tpl index 338a8f9..132719c 100644 --- a/locations/templates/quarkus-application/manifests/helm/deploy/templates/_helpers.tpl +++ b/locations/templates/quarkus-application/manifests/helm/deploy/templates/_helpers.tpl @@ -65,6 +65,7 @@ Selector labels {{- define "quarkus-template.selectorLabels" -}} app.kubernetes.io/name: {{ include "quarkus-template.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} +app.quarkus.io/quarkus-version: {{ .Values.app.quarkusVersion }} {{- end }} {{/* diff --git a/locations/templates/quarkus-application/manifests/helm/deploy/values.yaml b/locations/templates/quarkus-application/manifests/helm/deploy/values.yaml index a4ada8c..f0a3620 100644 --- a/locations/templates/quarkus-application/manifests/helm/deploy/values.yaml +++ b/locations/templates/quarkus-application/manifests/helm/deploy/values.yaml @@ -6,6 +6,7 @@ app: version: ${{ values.version }} namespace: ${{ values.appNamespace }} database: ${{ values.database }} + quarkusVersion: ${{ values.quarkusVersion }} git: repo: ${{ values.git_repo }} diff --git a/locations/templates/quarkus-application/skeletons/catalog-info/catalog-info.yaml b/locations/templates/quarkus-application/skeletons/catalog-info/catalog-info.yaml index 023753a..11e3b73 100644 --- a/locations/templates/quarkus-application/skeletons/catalog-info/catalog-info.yaml +++ b/locations/templates/quarkus-application/skeletons/catalog-info/catalog-info.yaml @@ -30,7 +30,7 @@ metadata: github.com/project-slug: ${{ values.orgName }}/${{ values.repoName }} # See: topology annotation: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/topology app.kubernetes.io/name: quarkus - app.quarkus.io/quarkus-version: "${{ quarkusVersion }}" + app.quarkus.io/quarkus-version: ${{ values.quarkusVersion }} tags: - java - quarkus diff --git a/locations/templates/quarkus-application/template.yaml b/locations/templates/quarkus-application/template.yaml index 51ed144..bdffeb4 100644 --- a/locations/templates/quarkus-application/template.yaml +++ b/locations/templates/quarkus-application/template.yaml @@ -260,7 +260,7 @@ spec: - iocanel steps: - - id: template + - id: quarkus-app-create name: Generating the Source Code Component action: quarkus:app:create input: @@ -364,6 +364,8 @@ spec: git_branch: main image_url: ${{ parameters.imageUrl }} appNamespace: ${{ parameters.namespace }} + version: ${{ parameters.version }} + quarkusVersion: ${{ parameters.quarkusVersion}} virtualMachineName: ${{ parameters.virtualMachineName }} virtualMachineNamespace: ${{ parameters.virtualMachineNamespace }} native: ${{ parameters.native }} diff --git a/locations/templates/quarkus-chatbot/manifests/helm/deploy/templates/_helpers.tpl b/locations/templates/quarkus-chatbot/manifests/helm/deploy/templates/_helpers.tpl index 338a8f9..132719c 100644 --- a/locations/templates/quarkus-chatbot/manifests/helm/deploy/templates/_helpers.tpl +++ b/locations/templates/quarkus-chatbot/manifests/helm/deploy/templates/_helpers.tpl @@ -65,6 +65,7 @@ Selector labels {{- define "quarkus-template.selectorLabels" -}} app.kubernetes.io/name: {{ include "quarkus-template.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} +app.quarkus.io/quarkus-version: {{ .Values.app.quarkusVersion }} {{- end }} {{/* diff --git a/locations/templates/quarkus-chatbot/manifests/helm/deploy/values.yaml b/locations/templates/quarkus-chatbot/manifests/helm/deploy/values.yaml index a4ada8c..f0a3620 100644 --- a/locations/templates/quarkus-chatbot/manifests/helm/deploy/values.yaml +++ b/locations/templates/quarkus-chatbot/manifests/helm/deploy/values.yaml @@ -6,6 +6,7 @@ app: version: ${{ values.version }} namespace: ${{ values.appNamespace }} database: ${{ values.database }} + quarkusVersion: ${{ values.quarkusVersion }} git: repo: ${{ values.git_repo }} diff --git a/locations/templates/quarkus-chatbot/skeletons/catalog-info/catalog-info.yaml b/locations/templates/quarkus-chatbot/skeletons/catalog-info/catalog-info.yaml index d62db57..2337d18 100644 --- a/locations/templates/quarkus-chatbot/skeletons/catalog-info/catalog-info.yaml +++ b/locations/templates/quarkus-chatbot/skeletons/catalog-info/catalog-info.yaml @@ -30,7 +30,7 @@ metadata: github.com/project-slug: ${{ values.orgName }}/${{ values.repoName }} # See: topology annotation: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/topology app.kubernetes.io/name: quarkus - app.quarkus.io/quarkus-version: "${{ quarkusVersion }}" + app.quarkus.io/quarkus-version: ${{ values.quarkusVersion }} tags: - java - quarkus diff --git a/locations/templates/quarkus-chatbot/template.yaml b/locations/templates/quarkus-chatbot/template.yaml index b854f33..d6422b4 100644 --- a/locations/templates/quarkus-chatbot/template.yaml +++ b/locations/templates/quarkus-chatbot/template.yaml @@ -228,7 +228,7 @@ spec: default: test1 steps: - - id: template + - id: quarkus-app-create name: Generating the Source Code Component action: quarkus:app:create input: @@ -362,6 +362,8 @@ spec: virtualMachineName: ${{ parameters.virtualMachineName }} virtualMachineNamespace: ${{ parameters.virtualMachineNamespace }} native: ${{ parameters.native }} + version: ${{ parameters.version }} + quarkusVersion: ${{ parameters.quarkusVersion}} - id: publish name: Publishing to Code Source Repository - Github diff --git a/locations/templates/quarkus-quickstart/template.yaml b/locations/templates/quarkus-quickstart/template.yaml index 8c4c62b..008c6f1 100644 --- a/locations/templates/quarkus-quickstart/template.yaml +++ b/locations/templates/quarkus-quickstart/template.yaml @@ -141,7 +141,7 @@ spec: type: string description: The namespace for deploying resources steps: - - id: template + - id: quarkus-quickstart-clone name: Generating the Source Code Component action: quarkus:quickstart:clone input: @@ -151,6 +151,7 @@ spec: version: ${{ parameters.version }} quickstartName: ${{ parameters.quickstartName }} additionalProperties: ${{ parameters.additionalProperties }} + quarkusVersion: ${{ parameters.quarkusVersion }} - id: ciTemplate name: Generating the CI Component action: fetch:template diff --git a/locations/templates/quarkus-rest-client/manifests/helm/deploy/templates/_helpers.tpl b/locations/templates/quarkus-rest-client/manifests/helm/deploy/templates/_helpers.tpl index 338a8f9..132719c 100644 --- a/locations/templates/quarkus-rest-client/manifests/helm/deploy/templates/_helpers.tpl +++ b/locations/templates/quarkus-rest-client/manifests/helm/deploy/templates/_helpers.tpl @@ -65,6 +65,7 @@ Selector labels {{- define "quarkus-template.selectorLabels" -}} app.kubernetes.io/name: {{ include "quarkus-template.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} +app.quarkus.io/quarkus-version: {{ .Values.app.quarkusVersion }} {{- end }} {{/* diff --git a/locations/templates/quarkus-rest-client/manifests/helm/deploy/values.yaml b/locations/templates/quarkus-rest-client/manifests/helm/deploy/values.yaml index a4ada8c..f0a3620 100644 --- a/locations/templates/quarkus-rest-client/manifests/helm/deploy/values.yaml +++ b/locations/templates/quarkus-rest-client/manifests/helm/deploy/values.yaml @@ -6,6 +6,7 @@ app: version: ${{ values.version }} namespace: ${{ values.appNamespace }} database: ${{ values.database }} + quarkusVersion: ${{ values.quarkusVersion }} git: repo: ${{ values.git_repo }} diff --git a/locations/templates/quarkus-rest-client/skeletons/catalog-info/catalog-info.yaml b/locations/templates/quarkus-rest-client/skeletons/catalog-info/catalog-info.yaml index d62db57..2337d18 100644 --- a/locations/templates/quarkus-rest-client/skeletons/catalog-info/catalog-info.yaml +++ b/locations/templates/quarkus-rest-client/skeletons/catalog-info/catalog-info.yaml @@ -30,7 +30,7 @@ metadata: github.com/project-slug: ${{ values.orgName }}/${{ values.repoName }} # See: topology annotation: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/topology app.kubernetes.io/name: quarkus - app.quarkus.io/quarkus-version: "${{ quarkusVersion }}" + app.quarkus.io/quarkus-version: ${{ values.quarkusVersion }} tags: - java - quarkus diff --git a/locations/templates/quarkus-rest-client/template.yaml b/locations/templates/quarkus-rest-client/template.yaml index 8ea7be5..4b44d2f 100644 --- a/locations/templates/quarkus-rest-client/template.yaml +++ b/locations/templates/quarkus-rest-client/template.yaml @@ -226,7 +226,7 @@ spec: default: test1 steps: - - id: template + - id: quarkus-app-create name: Generating the Source Code Component action: quarkus:app:create input: diff --git a/plugins/quarkus-backend/src/scaffolder/actions/quarkus/createApp.ts b/plugins/quarkus-backend/src/scaffolder/actions/quarkus/createApp.ts index 127a3cf..10f06a6 100644 --- a/plugins/quarkus-backend/src/scaffolder/actions/quarkus/createApp.ts +++ b/plugins/quarkus-backend/src/scaffolder/actions/quarkus/createApp.ts @@ -119,8 +119,11 @@ export const createQuarkusApp = () => { if (! ctx.input.values.starterCode) { noCode = "true"; } + + const streamkey = buildStreamKeyFromVersion(ctx.input.values.quarkusVersion); + const postData = { - streamKey: ctx.input.values.quarkusVersion ? ctx.input.values.quarkusVersion : 'io.quarkus.platform:3.9', + streamKey: streamkey, groupId: ctx.input.values.groupId ? ctx.input.values.groupId : 'org.acme', artifactId: ctx.input.values.artifactId ? ctx.input.values.artifactId : 'code-with-quarkus', version: ctx.input.values.version ? ctx.input.values.version : '1.0.0-SNAPSHOT', @@ -175,4 +178,17 @@ export const createQuarkusApp = () => { } }, }); + function buildStreamKeyFromVersion( + quarkusVersion: string, + ): string { + if (!quarkusVersion) { + throw new Error(`Quarkus version to be processed cannot be empty`); + } + let quarkusVersionDigits = quarkusVersion.split(".") + if (quarkusVersionDigits.length < 3) { + throw new Error(`The version is not formatted as: X.Y.Z\`); + } else { + return "io.quarkus.platform:"+quarkusVersionDigits[0]+"."+quarkusVersionDigits[1]; + } + } }; diff --git a/plugins/quarkus/src/scaffolder/QuarkusVersionList.tsx b/plugins/quarkus/src/scaffolder/QuarkusVersionList.tsx index 11d9593..c132c8f 100644 --- a/plugins/quarkus/src/scaffolder/QuarkusVersionList.tsx +++ b/plugins/quarkus/src/scaffolder/QuarkusVersionList.tsx @@ -51,14 +51,14 @@ function findRecommendedVersion(versions: Version[]) { let recommendedVersion = ''; versions.forEach((v: Version) => { if (v.recommended) { - recommendedVersion = v.key + recommendedVersion = v.quarkusCoreVersion } }) return recommendedVersion; } export const QuarkusVersionList = (props: FieldExtensionComponentProps) => { - const { + let { onChange, rawErrors, required, @@ -74,13 +74,13 @@ export const QuarkusVersionList = (props: FieldExtensionComponentProps) const recommendedVersion = findRecommendedVersion(newData); console.log(`Recommended version: ${recommendedVersion}`) - formData !== undefined ? formData : onChange(recommendedVersion !== '' ? recommendedVersion : newData[0].key); + formData !== undefined ? formData : onChange(recommendedVersion !== '' ? recommendedVersion : newData[0].quarkusCoreVersion); return newData; }); const versionItems: SelectItem[] = value - ? value?.map((i: Version) => ({label: userLabel(i), value: i.key})) + ? value?.map((i: Version) => ({label: userLabel(i), value: i.quarkusCoreVersion})) : [{label: 'Loading...', value: 'loading'}]; if (loading) {