Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v2.4.7 #612

Merged
merged 11 commits into from
Mar 20, 2025
15 changes: 11 additions & 4 deletions client/src/components/apps/addons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@
dense
v-model="field.default"
></v-select>
<v-combobox
v-if="field.type === 'combobox' && typeof field.default === 'string'"
:items="field.options"
:label="field.label"
item-title="text"
item-value="value"
dense
v-model="field.default"
></v-combobox>
<v-text-field
v-if="field.type === 'text'"
v-model="field.default"
Expand Down Expand Up @@ -309,7 +318,7 @@ export default defineComponent({

// set the formfields to the values from the yaml
//console.log(this.selectedAddon.formfields);
Object.entries(this.selectedAddon.formfields).forEach(([field, value]) => {
Object.entries(this.selectedAddon.formfields as FormField[]).forEach(([field, value]) => {
const fieldvalue = get(addon.resourceDefinitions, field, value.default)
//console.log(field, value, fieldvalue);
value.default = fieldvalue;
Expand Down Expand Up @@ -338,7 +347,7 @@ export default defineComponent({
this.dialog = false;

// replace the formfields with the form value
Object.entries(this.selectedAddon.formfields).forEach(([field, value]) => {
Object.entries(this.selectedAddon.formfields as FormField[]).forEach(([field, value]) => {

// Cast number fields to int
if (value.type === 'number' && typeof value.default === 'string') {
Expand All @@ -364,8 +373,6 @@ export default defineComponent({
resourceDefinitions: this.selectedAddon.resourceDefinitions,
} as Addon;

//console.log(addon);

if (this.mode === 'create') {
this.addAddon(addon);
} else {
Expand Down
9 changes: 6 additions & 3 deletions client/src/components/apps/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1802,10 +1802,13 @@ export default defineComponent({
(v: any) => /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(v) || 'Allowed characters : [a-zA-Z0-9_-]',
],
repositoryRules: [
//v => !!v || 'Repository is required',
(v: any) => v.length <= 120 || 'Repository must be less than 120 characters',
//(v: any) => !!v || 'Repository is required',
//(v: any) => v.length <= 120 || 'Repository must be less than 120 characters',
// ((git|ssh|http(s)?)|(git@[\w\.]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?
(v: any) => /((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:/\-~]+)(\.git)(\/)?/.test(v) || 'Format "owner/repository"',
// ((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:\/\-~]+)(\.git)
// (git@[\w.]+:\/\/)([\w.\/\-~]+)(\.git) // not working
// ((git|ssh|http(s)?)|(git@[\w\.-]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?
(v: any) => /^((git|ssh|http(s)?)|(git@[\w\.-]+))(:(\/\/)?)([\w\.@\:\/\-~]+)(\.git)(\/)?/.test(v) || 'Format "[email protected]:organisation/repository.git"',
],
domainRules: [
(v: any) => !!v || 'Domain is required',
Expand Down
14 changes: 12 additions & 2 deletions client/src/components/settings/form-deployment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,19 @@

<h4 class="text-uppercase">Github</h4>
<v-row>
<v-col
cols="12"
md="3"
>
<v-text-field
v-model="settings.secrets.GITHUB_BASEURL"
label="github Base Url"
required
></v-text-field>
</v-col>
<v-col
cols="12"
md="6"
md="3"
>
<v-text-field
v-model="settings.secrets.GITHUB_PERSONAL_ACCESS_TOKEN"
Expand Down Expand Up @@ -218,4 +228,4 @@ export default defineComponent({
}
})

</script>
</script>
4 changes: 3 additions & 1 deletion client/src/components/settings/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import FormNotifications from './form-notifications.vue'

// types & interfaces
export interface Secrets {
GITHUB_BASEURL: string;
GITHUB_PERSONAL_ACCESS_TOKEN: string;
GITEA_PERSONAL_ACCESS_TOKEN: string;
GITEA_BASEURL: string;
Expand Down Expand Up @@ -389,6 +390,7 @@ export default defineComponent({
show: false,
settings: {
secrets: {
GITHUB_BASEURL: '',
GITHUB_PERSONAL_ACCESS_TOKEN: '',
GITEA_PERSONAL_ACCESS_TOKEN: '',
GITEA_BASEURL: '',
Expand Down Expand Up @@ -548,4 +550,4 @@ export default defineComponent({
</script>

<style lang="scss">
</style>
</style>
44 changes: 40 additions & 4 deletions client/src/components/templates/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,38 @@
prepend-icon="mdi-file-certificate"
v-if="template.spdx_id && template.spdx_id !== 'NOASSERTION'"
>{{ template.spdx_id }}</v-chip>
<br>
<v-chip
v-for="category in template.categories"
:key="category"
label
size="x-small"
class="mr-2 mt-2"
prepend-icon="mdi-tag"
@click="filterByCategory(category)"
>{{ category }}</v-chip>
</v-card-subtitle>
<v-card-text style="height: 150px">
<v-card-text style="height: 150px" class="overflow-y-auto">
{{ template.description }}
<!--Operator: <a :href="template.url">{{ template.id }}</a>-->
<!--<v-chip
v-for="addon in template.addons"
:key="addon"
label
size="small"
class="mr-2"
prepend-icon="mdi-plus"
>{{ addon }}</v-chip>-->
</v-card-text>
<v-card-text style="height: 60px" class="d-flex justify-left mb-0">
<v-avatar
v-for="addon in template.addons"
class="pa-2 mr-2"
color="grey-lighten-2"
rounded
:key="addon"
:image="addonImages[addon]">
</v-avatar>
</v-card-text>

<v-divider></v-divider>
Expand Down Expand Up @@ -154,6 +182,7 @@
import axios from "axios";
import { forEach } from "lodash";
import { defineComponent } from 'vue'
import { useRouter } from 'vue-router'

type Pipeline = {
name: string,
Expand Down Expand Up @@ -187,6 +216,7 @@ type Template = {
last_updated: string,
last_pushed: string,
status: string,

}

type Templates = {
Expand Down Expand Up @@ -232,6 +262,12 @@ export default defineComponent({
dialog: false,
clickedTemplate: {} as Template,
catalogId: 0,
addonImages: {
'KuberoPostgresql': '/img/addons/pgsql.svg',
'KuberoMysql': '/img/addons/mysql.svg',
'KuberoRedis': '/img/addons/redis.svg',
'KuberoMongoDB': '/img/addons/mongo.svg',
} as { [key: string]: string },
templates: {
enabled: true,
catalogs: [] as Catalog[],
Expand All @@ -258,10 +294,10 @@ export default defineComponent({
this.dialog = false;
},
openInstall(templateurl: string, pipeline: string, phase: string) {
const router = useRouter();
// redirect to install page
const templateurlB64 = btoa(templateurl);
this.$router.push({ name: 'App Form', params: { pipeline: pipeline, phase: phase, app: 'new'}, query: { template: templateurlB64 }})

router.push({ name: 'App Form', params: { pipeline: pipeline, phase: phase, app: 'new'}, query: { template: templateurlB64 }})
},
openInstallDialog(template: Template) {
this.clickedTemplate = template;
Expand All @@ -282,7 +318,7 @@ export default defineComponent({
});
},
filterByCategory(selectedCategory: string) {
console.log(selectedCategory);

if (selectedCategory === 'All') {
this.showedTemplates.services = this.templatesList.services;
} else {
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoCouchDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoCouchDB extends Plugin implements IPlugin {
default: 'couchdb',
description: 'The name of the Couchdb instance'
},
'KuberoCouchDB.spec.couchdb.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['3.2.1', '3.3', '3.4.2', 'latest'], // TODO - load this dynamically
name: 'spec.couchdb.image.tag',
required: true,
default: '3.2.1',
description: 'Version of the PostgreSQL image to use'
},
'KuberoCouchDB.spec.couchdb.clusterSize':{
type: 'number',
label: 'Cluster Size*',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoElasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoElasticsearch extends Plugin implements IPlugin {
default: 'elasticsearch',
description: 'The name of the elasticsearch instance'
},
'KuberoElasticsearch.spec.elasticsearch.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['7', '7.17.26', '8.6.0-debian-11-r0', '8', '8.17.1', 'latest'], // TODO - load this dynamically
name: 'spec.couchdb.image.tag',
required: true,
default: '8.6.0-debian-11-r0',
description: 'Version of the PostgreSQL image to use'
},
'KuberoElasticsearch.spec.elasticsearch.global.storageClass':{
type: 'select-storageclass',
label: 'Storage Class',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoMemcached.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoMemcached extends Plugin implements IPlugin {
default: 'memcached',
description: 'The name of the Memcached instance'
},
'KuberoMemcached.spec.memcached.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['1.6.22-debian-11-r1', '1', '1.6.34', 'latest'], // TODO - load this dynamically
name: 'spec.memcached.image.tag',
required: true,
default: '1.6.22-debian-11-r1',
description: 'Version of the PostgreSQL image to use'
},
'KuberoMemcached.spec.memcached.architecture':{
type: 'select',
label: 'Architecture*',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoMongoDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoMongoDB extends Plugin implements IPlugin {
default: 'mongodb',
description: 'The name of tht MongoDB instance'
},
'KuberoMongoDB.spec.mongodb.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['6.0.6-debian-11-r3', '7.0.15', '8.0', '8.0.4', 'latest'], // TODO - load this dynamically
name: 'spec.mongodb.image.tag',
required: true,
default: '8.0',
description: 'Version of the PostgreSQL image to use'
},
'KuberoMongoDB.spec.mongodb.global.storageClass':{
type: 'select-storageclass',
label: 'Storage Class',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoMysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoMysql extends Plugin implements IPlugin {
default: 'mysql',
description: 'The name of the MySQL instance'
},
'KuberoMysql.spec.mysql.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['8.0.33-debian-11-r12', '8.1', '8.2-debian-11', '8.4.4', '9.0', 'latest'], // TODO - load this dynamically
name: 'spec.mysql.image.tag',
required: true,
default: '8.4.4',
description: 'Version of the PostgreSQL image to use'
},
'KuberoMysql.spec.mysql.global.storageClass':{
type: 'select-storageclass',
label: 'Storage Class',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoPostgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoPostgresql extends Plugin implements IPlugin {
default: 'postgresql',
description: 'The name of the PostgreSQL instance'
},
'KuberoPostgresql.spec.postgresql.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['13', '14', '15', '16.6.0', '17.2.0', 'latest'], // TODO - load this dynamically
name: 'spec.postgresql.image.tag',
required: true,
default: '16',
description: 'Version of the PostgreSQL image to use'
},
'KuberoPostgresql.spec.postgresql.global.postgresql.auth.postgresPassword':{
type: 'text',
label: 'Postgres admin Password*',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoRabbitMQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoRabbitMQ extends Plugin implements IPlugin {
default: 'rabbitmq',
description: 'The name of the PostgreSQL instance'
},
'KuberoRabbitMQ.spec.rabbitmq.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['3.12.10-debian-11-r1', '3.13.7', '4.0.5', 'latest'], // TODO - load this dynamically
name: 'spec.rabbitmq.image.tag',
required: true,
default: '3.12.10-debian-11-r1',
description: 'Version of the PostgreSQL image to use'
},
'KuberoRabbitMQ.spec.rabbitmq.auth.username':{
type: 'text',
label: 'User Name*',
Expand Down
9 changes: 9 additions & 0 deletions server/src/addons/kuberoRedis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class KuberoRedis extends Plugin implements IPlugin {
default: 'redis',
description: 'The name of the redis instance'
},
'KuberoRedis.spec.redis.image.tag':{
type: 'combobox',
label: 'Version/Tag',
options: ['7.0.7-debian-11-r7', '6.2', '7.4.2', 'latest'], // TODO - load this dynamically
name: 'spec.redis.image.tag',
required: true,
default: '7.0-debian-12',
description: 'Version of the PostgreSQL image to use'
},
'KuberoRedis.spec.redis.replica.replicaCount':{
type: 'number',
label: 'Replica Count*',
Expand Down
2 changes: 1 addition & 1 deletion server/src/addons/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from 'axios';
import { KubernetesListObject, KubernetesObject } from '@kubernetes/client-node'

export interface IPluginFormFields {
type: 'text' | 'number' |'switch' | 'select' | 'select-storageclass',
type: 'text' | 'number' |'switch' | 'select' | 'select-storageclass' | 'combobox',
label: string,
name: string,
required: boolean,
Expand Down
12 changes: 9 additions & 3 deletions server/src/git/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ import { RequestError } from '@octokit/types';
export class GithubApi extends Repo {
private octokit: any;

constructor(token: string) {
constructor(baseUrl: string, token: string) {
super("github");

if (baseUrl === '') {
baseUrl = 'https://api.github.com';
}

this.octokit = new Octokit({
auth: token
auth: token,
baseUrl: baseUrl,
});
}

Expand Down Expand Up @@ -398,4 +404,4 @@ export class GithubApi extends Repo {

return ret;
}
}
}
2 changes: 1 addition & 1 deletion server/src/git/repo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GiteaApi } from './gitea';

describe('GithubApi', () => {
it('should load config', () => {
const github = new GithubApi("token");
const github = new GithubApi('', "token");
expect(github).toBeTruthy();
});
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/kubero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class Kubero {

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

Expand Down
2 changes: 1 addition & 1 deletion server/src/modules/repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Repositories {
constructor() {
this.giteaApi = new GiteaApi(process.env.GITEA_BASEURL as string, process.env.GITEA_PERSONAL_ACCESS_TOKEN as string);
this.gogsApi = new GogsApi(process.env.GOGS_BASEURL as string, process.env.GOGS_PERSONAL_ACCESS_TOKEN as string);
this.githubApi = new GithubApi(process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
this.githubApi = new GithubApi(process.env.GITHUB_BASEURL as string, process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
this.gitlabApi = new GitlabApi(process.env.GITLAB_BASEURL as string, process.env.GITLAB_PERSONAL_ACCESS_TOKEN as string);
this.bitbucketApi = new BitbucketApi(process.env.BITBUCKET_USERNAME as string, process.env.BITBUCKET_APP_PASSWORD as string);
}
Expand Down
Loading
Loading