Skip to content

Commit 01438d2

Browse files
authored
Merge pull request #612 from kubero-dev/release/v2.4.7
Release/v2.4.7
2 parents 7a0f702 + 058cc59 commit 01438d2

19 files changed

+159
-21
lines changed

client/src/components/apps/addons.vue

+11-4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@
119119
dense
120120
v-model="field.default"
121121
></v-select>
122+
<v-combobox
123+
v-if="field.type === 'combobox' && typeof field.default === 'string'"
124+
:items="field.options"
125+
:label="field.label"
126+
item-title="text"
127+
item-value="value"
128+
dense
129+
v-model="field.default"
130+
></v-combobox>
122131
<v-text-field
123132
v-if="field.type === 'text'"
124133
v-model="field.default"
@@ -309,7 +318,7 @@ export default defineComponent({
309318
310319
// set the formfields to the values from the yaml
311320
//console.log(this.selectedAddon.formfields);
312-
Object.entries(this.selectedAddon.formfields).forEach(([field, value]) => {
321+
Object.entries(this.selectedAddon.formfields as FormField[]).forEach(([field, value]) => {
313322
const fieldvalue = get(addon.resourceDefinitions, field, value.default)
314323
//console.log(field, value, fieldvalue);
315324
value.default = fieldvalue;
@@ -338,7 +347,7 @@ export default defineComponent({
338347
this.dialog = false;
339348
340349
// replace the formfields with the form value
341-
Object.entries(this.selectedAddon.formfields).forEach(([field, value]) => {
350+
Object.entries(this.selectedAddon.formfields as FormField[]).forEach(([field, value]) => {
342351
343352
// Cast number fields to int
344353
if (value.type === 'number' && typeof value.default === 'string') {
@@ -364,8 +373,6 @@ export default defineComponent({
364373
resourceDefinitions: this.selectedAddon.resourceDefinitions,
365374
} as Addon;
366375
367-
//console.log(addon);
368-
369376
if (this.mode === 'create') {
370377
this.addAddon(addon);
371378
} else {

client/src/components/apps/form.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -1802,10 +1802,13 @@ export default defineComponent({
18021802
(v: any) => /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(v) || 'Allowed characters : [a-zA-Z0-9_-]',
18031803
],
18041804
repositoryRules: [
1805-
//v => !!v || 'Repository is required',
1806-
(v: any) => v.length <= 120 || 'Repository must be less than 120 characters',
1805+
//(v: any) => !!v || 'Repository is required',
1806+
//(v: any) => v.length <= 120 || 'Repository must be less than 120 characters',
18071807
// ((git|ssh|http(s)?)|(git@[\w\.]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?
1808-
(v: any) => /((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:/\-~]+)(\.git)(\/)?/.test(v) || 'Format "owner/repository"',
1808+
// ((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:\/\-~]+)(\.git)
1809+
// (git@[\w.]+:\/\/)([\w.\/\-~]+)(\.git) // not working
1810+
// ((git|ssh|http(s)?)|(git@[\w\.-]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?
1811+
(v: any) => /^((git|ssh|http(s)?)|(git@[\w\.-]+))(:(\/\/)?)([\w\.@\:\/\-~]+)(\.git)(\/)?/.test(v) || 'Format "[email protected]:organisation/repository.git"',
18091812
],
18101813
domainRules: [
18111814
(v: any) => !!v || 'Domain is required',

client/src/components/settings/form-deployment.vue

+12-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,19 @@
5454

5555
<h4 class="text-uppercase">Github</h4>
5656
<v-row>
57+
<v-col
58+
cols="12"
59+
md="3"
60+
>
61+
<v-text-field
62+
v-model="settings.secrets.GITHUB_BASEURL"
63+
label="github Base Url"
64+
required
65+
></v-text-field>
66+
</v-col>
5767
<v-col
5868
cols="12"
59-
md="6"
69+
md="3"
6070
>
6171
<v-text-field
6272
v-model="settings.secrets.GITHUB_PERSONAL_ACCESS_TOKEN"
@@ -218,4 +228,4 @@ export default defineComponent({
218228
}
219229
})
220230
221-
</script>
231+
</script>

client/src/components/settings/form.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import FormNotifications from './form-notifications.vue'
6565
6666
// types & interfaces
6767
export interface Secrets {
68+
GITHUB_BASEURL: string;
6869
GITHUB_PERSONAL_ACCESS_TOKEN: string;
6970
GITEA_PERSONAL_ACCESS_TOKEN: string;
7071
GITEA_BASEURL: string;
@@ -389,6 +390,7 @@ export default defineComponent({
389390
show: false,
390391
settings: {
391392
secrets: {
393+
GITHUB_BASEURL: '',
392394
GITHUB_PERSONAL_ACCESS_TOKEN: '',
393395
GITEA_PERSONAL_ACCESS_TOKEN: '',
394396
GITEA_BASEURL: '',
@@ -548,4 +550,4 @@ export default defineComponent({
548550
</script>
549551

550552
<style lang="scss">
551-
</style>
553+
</style>

client/src/components/templates/index.vue

+40-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,38 @@
6969
prepend-icon="mdi-file-certificate"
7070
v-if="template.spdx_id && template.spdx_id !== 'NOASSERTION'"
7171
>{{ template.spdx_id }}</v-chip>
72+
<br>
73+
<v-chip
74+
v-for="category in template.categories"
75+
:key="category"
76+
label
77+
size="x-small"
78+
class="mr-2 mt-2"
79+
prepend-icon="mdi-tag"
80+
@click="filterByCategory(category)"
81+
>{{ category }}</v-chip>
7282
</v-card-subtitle>
73-
<v-card-text style="height: 150px">
83+
<v-card-text style="height: 150px" class="overflow-y-auto">
7484
{{ template.description }}
7585
<!--Operator: <a :href="template.url">{{ template.id }}</a>-->
86+
<!--<v-chip
87+
v-for="addon in template.addons"
88+
:key="addon"
89+
label
90+
size="small"
91+
class="mr-2"
92+
prepend-icon="mdi-plus"
93+
>{{ addon }}</v-chip>-->
94+
</v-card-text>
95+
<v-card-text style="height: 60px" class="d-flex justify-left mb-0">
96+
<v-avatar
97+
v-for="addon in template.addons"
98+
class="pa-2 mr-2"
99+
color="grey-lighten-2"
100+
rounded
101+
:key="addon"
102+
:image="addonImages[addon]">
103+
</v-avatar>
76104
</v-card-text>
77105

78106
<v-divider></v-divider>
@@ -154,6 +182,7 @@
154182
import axios from "axios";
155183
import { forEach } from "lodash";
156184
import { defineComponent } from 'vue'
185+
import { useRouter } from 'vue-router'
157186
158187
type Pipeline = {
159188
name: string,
@@ -187,6 +216,7 @@ type Template = {
187216
last_updated: string,
188217
last_pushed: string,
189218
status: string,
219+
190220
}
191221
192222
type Templates = {
@@ -232,6 +262,12 @@ export default defineComponent({
232262
dialog: false,
233263
clickedTemplate: {} as Template,
234264
catalogId: 0,
265+
addonImages: {
266+
'KuberoPostgresql': '/img/addons/pgsql.svg',
267+
'KuberoMysql': '/img/addons/mysql.svg',
268+
'KuberoRedis': '/img/addons/redis.svg',
269+
'KuberoMongoDB': '/img/addons/mongo.svg',
270+
} as { [key: string]: string },
235271
templates: {
236272
enabled: true,
237273
catalogs: [] as Catalog[],
@@ -258,10 +294,10 @@ export default defineComponent({
258294
this.dialog = false;
259295
},
260296
openInstall(templateurl: string, pipeline: string, phase: string) {
297+
const router = useRouter();
261298
// redirect to install page
262299
const templateurlB64 = btoa(templateurl);
263-
this.$router.push({ name: 'App Form', params: { pipeline: pipeline, phase: phase, app: 'new'}, query: { template: templateurlB64 }})
264-
300+
router.push({ name: 'App Form', params: { pipeline: pipeline, phase: phase, app: 'new'}, query: { template: templateurlB64 }})
265301
},
266302
openInstallDialog(template: Template) {
267303
this.clickedTemplate = template;
@@ -282,7 +318,7 @@ export default defineComponent({
282318
});
283319
},
284320
filterByCategory(selectedCategory: string) {
285-
console.log(selectedCategory);
321+
286322
if (selectedCategory === 'All') {
287323
this.showedTemplates.services = this.templatesList.services;
288324
} else {

server/src/addons/kuberoCouchDB.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoCouchDB extends Plugin implements IPlugin {
2424
default: 'couchdb',
2525
description: 'The name of the Couchdb instance'
2626
},
27+
'KuberoCouchDB.spec.couchdb.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['3.2.1', '3.3', '3.4.2', 'latest'], // TODO - load this dynamically
31+
name: 'spec.couchdb.image.tag',
32+
required: true,
33+
default: '3.2.1',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoCouchDB.spec.couchdb.clusterSize':{
2837
type: 'number',
2938
label: 'Cluster Size*',

server/src/addons/kuberoElasticsearch.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoElasticsearch extends Plugin implements IPlugin {
2424
default: 'elasticsearch',
2525
description: 'The name of the elasticsearch instance'
2626
},
27+
'KuberoElasticsearch.spec.elasticsearch.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['7', '7.17.26', '8.6.0-debian-11-r0', '8', '8.17.1', 'latest'], // TODO - load this dynamically
31+
name: 'spec.couchdb.image.tag',
32+
required: true,
33+
default: '8.6.0-debian-11-r0',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoElasticsearch.spec.elasticsearch.global.storageClass':{
2837
type: 'select-storageclass',
2938
label: 'Storage Class',

server/src/addons/kuberoMemcached.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoMemcached extends Plugin implements IPlugin {
2424
default: 'memcached',
2525
description: 'The name of the Memcached instance'
2626
},
27+
'KuberoMemcached.spec.memcached.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['1.6.22-debian-11-r1', '1', '1.6.34', 'latest'], // TODO - load this dynamically
31+
name: 'spec.memcached.image.tag',
32+
required: true,
33+
default: '1.6.22-debian-11-r1',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoMemcached.spec.memcached.architecture':{
2837
type: 'select',
2938
label: 'Architecture*',

server/src/addons/kuberoMongoDB.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoMongoDB extends Plugin implements IPlugin {
2424
default: 'mongodb',
2525
description: 'The name of tht MongoDB instance'
2626
},
27+
'KuberoMongoDB.spec.mongodb.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['6.0.6-debian-11-r3', '7.0.15', '8.0', '8.0.4', 'latest'], // TODO - load this dynamically
31+
name: 'spec.mongodb.image.tag',
32+
required: true,
33+
default: '8.0',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoMongoDB.spec.mongodb.global.storageClass':{
2837
type: 'select-storageclass',
2938
label: 'Storage Class',

server/src/addons/kuberoMysql.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoMysql extends Plugin implements IPlugin {
2424
default: 'mysql',
2525
description: 'The name of the MySQL instance'
2626
},
27+
'KuberoMysql.spec.mysql.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['8.0.33-debian-11-r12', '8.1', '8.2-debian-11', '8.4.4', '9.0', 'latest'], // TODO - load this dynamically
31+
name: 'spec.mysql.image.tag',
32+
required: true,
33+
default: '8.4.4',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoMysql.spec.mysql.global.storageClass':{
2837
type: 'select-storageclass',
2938
label: 'Storage Class',

server/src/addons/kuberoPostgresql.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoPostgresql extends Plugin implements IPlugin {
2424
default: 'postgresql',
2525
description: 'The name of the PostgreSQL instance'
2626
},
27+
'KuberoPostgresql.spec.postgresql.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['13', '14', '15', '16.6.0', '17.2.0', 'latest'], // TODO - load this dynamically
31+
name: 'spec.postgresql.image.tag',
32+
required: true,
33+
default: '16',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoPostgresql.spec.postgresql.global.postgresql.auth.postgresPassword':{
2837
type: 'text',
2938
label: 'Postgres admin Password*',

server/src/addons/kuberoRabbitMQ.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoRabbitMQ extends Plugin implements IPlugin {
2424
default: 'rabbitmq',
2525
description: 'The name of the PostgreSQL instance'
2626
},
27+
'KuberoRabbitMQ.spec.rabbitmq.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['3.12.10-debian-11-r1', '3.13.7', '4.0.5', 'latest'], // TODO - load this dynamically
31+
name: 'spec.rabbitmq.image.tag',
32+
required: true,
33+
default: '3.12.10-debian-11-r1',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoRabbitMQ.spec.rabbitmq.auth.username':{
2837
type: 'text',
2938
label: 'User Name*',

server/src/addons/kuberoRedis.ts

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export class KuberoRedis extends Plugin implements IPlugin {
2424
default: 'redis',
2525
description: 'The name of the redis instance'
2626
},
27+
'KuberoRedis.spec.redis.image.tag':{
28+
type: 'combobox',
29+
label: 'Version/Tag',
30+
options: ['7.0.7-debian-11-r7', '6.2', '7.4.2', 'latest'], // TODO - load this dynamically
31+
name: 'spec.redis.image.tag',
32+
required: true,
33+
default: '7.0-debian-12',
34+
description: 'Version of the PostgreSQL image to use'
35+
},
2736
'KuberoRedis.spec.redis.replica.replicaCount':{
2837
type: 'number',
2938
label: 'Replica Count*',

server/src/addons/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from 'axios';
22
import { KubernetesListObject, KubernetesObject } from '@kubernetes/client-node'
33

44
export interface IPluginFormFields {
5-
type: 'text' | 'number' |'switch' | 'select' | 'select-storageclass',
5+
type: 'text' | 'number' |'switch' | 'select' | 'select-storageclass' | 'combobox',
66
label: string,
77
name: string,
88
required: boolean,

server/src/git/github.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ import { RequestError } from '@octokit/types';
1212
export class GithubApi extends Repo {
1313
private octokit: any;
1414

15-
constructor(token: string) {
15+
constructor(baseUrl: string, token: string) {
1616
super("github");
17+
18+
if (baseUrl === '') {
19+
baseUrl = 'https://api.github.com';
20+
}
21+
1722
this.octokit = new Octokit({
18-
auth: token
23+
auth: token,
24+
baseUrl: baseUrl,
1925
});
2026
}
2127

@@ -398,4 +404,4 @@ export class GithubApi extends Repo {
398404

399405
return ret;
400406
}
401-
}
407+
}

server/src/git/repo.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { GiteaApi } from './gitea';
66

77
describe('GithubApi', () => {
88
it('should load config', () => {
9-
const github = new GithubApi("token");
9+
const github = new GithubApi('', "token");
1010
expect(github).toBeTruthy();
1111
});
1212
});

server/src/kubero.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class Kubero {
8080

8181
this.giteaApi = new GiteaApi(process.env.GITEA_BASEURL as string, process.env.GITEA_PERSONAL_ACCESS_TOKEN as string);
8282
this.gogsApi = new GogsApi(process.env.GOGS_BASEURL as string, process.env.GOGS_PERSONAL_ACCESS_TOKEN as string);
83-
this.githubApi = new GithubApi(process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
83+
this.githubApi = new GithubApi(process.env.GITHUB_BASEURL as string, process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
8484
this.gitlabApi = new GitlabApi(process.env.GITLAB_BASEURL as string, process.env.GITLAB_PERSONAL_ACCESS_TOKEN as string);
8585
this.bitbucketApi = new BitbucketApi(process.env.BITBUCKET_USERNAME as string, process.env.BITBUCKET_APP_PASSWORD as string);
8686

server/src/modules/repositories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class Repositories {
1616
constructor() {
1717
this.giteaApi = new GiteaApi(process.env.GITEA_BASEURL as string, process.env.GITEA_PERSONAL_ACCESS_TOKEN as string);
1818
this.gogsApi = new GogsApi(process.env.GOGS_BASEURL as string, process.env.GOGS_PERSONAL_ACCESS_TOKEN as string);
19-
this.githubApi = new GithubApi(process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
19+
this.githubApi = new GithubApi(process.env.GITHUB_BASEURL as string, process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
2020
this.gitlabApi = new GitlabApi(process.env.GITLAB_BASEURL as string, process.env.GITLAB_PERSONAL_ACCESS_TOKEN as string);
2121
this.bitbucketApi = new BitbucketApi(process.env.BITBUCKET_USERNAME as string, process.env.BITBUCKET_APP_PASSWORD as string);
2222
}

0 commit comments

Comments
 (0)