Skip to content

Commit

Permalink
Merge pull request #162 from aureamunoz/add-quarkus-version-to-helm
Browse files Browse the repository at this point in the history
Add quarkus version to helm
  • Loading branch information
aureamunoz committed Jun 27, 2024
2 parents 7cf0201 + 56fd504 commit 052af72
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ app:
version: ${{ values.version }}
namespace: ${{ values.appNamespace }}
database: ${{ values.database }}
quarkusVersion: ${{ values.quarkusVersion }}

git:
repo: ${{ values.git_repo }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion locations/templates/quarkus-application/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ spec:
- iocanel

steps:
- id: template
- id: quarkus-app-create
name: Generating the Source Code Component
action: quarkus:app:create
input:
Expand Down Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ app:
version: ${{ values.version }}
namespace: ${{ values.appNamespace }}
database: ${{ values.database }}
quarkusVersion: ${{ values.quarkusVersion }}

git:
repo: ${{ values.git_repo }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion locations/templates/quarkus-chatbot/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion locations/templates/quarkus-quickstart/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ app:
version: ${{ values.version }}
namespace: ${{ values.appNamespace }}
database: ${{ values.database }}
quarkusVersion: ${{ values.quarkusVersion }}

git:
repo: ${{ values.git_repo }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion locations/templates/quarkus-rest-client/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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\<version\>`);
} else {
return "io.quarkus.platform:"+quarkusVersionDigits[0]+"."+quarkusVersionDigits[1];
}
}
};
8 changes: 4 additions & 4 deletions plugins/quarkus/src/scaffolder/QuarkusVersionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>) => {
const {
let {
onChange,
rawErrors,
required,
Expand All @@ -74,13 +74,13 @@ export const QuarkusVersionList = (props: FieldExtensionComponentProps<string>)

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) {
Expand Down

0 comments on commit 052af72

Please sign in to comment.