Skip to content

Commit e8dfc2d

Browse files
authored
Merge pull request #470 from kubero-dev/feature/make-command-field-accessible
Feature / Add field for command when deploying container images
2 parents e140d14 + 8ab7c69 commit e8dfc2d

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

client/src/components/apps/form.vue

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
value="git"
178178
></v-radio>
179179
<v-radio
180-
label="Docker Image"
180+
label="Container Image"
181181
value="docker"
182182
></v-radio>
183183
<!--
@@ -381,9 +381,9 @@
381381
</div> <!-- end of buildstrategy != external -->
382382
</div> <!-- end of deploymentstrategy == git -->
383383

384-
<!-- DEPLOYMENT STRATEGY CONTAINER -->
385-
<v-row
386-
v-if="deploymentstrategy == 'docker' || (deploymentstrategy == 'git' && buildstrategy == 'external' )">
384+
<!-- DEPLOYMENT STRATEGY CONTAINER -->
385+
<div v-if="deploymentstrategy == 'docker'">
386+
<v-row>
387387
<v-col
388388
cols="12"
389389
md="6"
@@ -396,8 +396,7 @@
396396
></v-text-field>
397397
</v-col>
398398
</v-row>
399-
<v-row
400-
v-if="deploymentstrategy == 'docker' || (deploymentstrategy == 'git' && buildstrategy == 'external' )">
399+
<v-row>
401400
<v-col
402401
cols="12"
403402
md="6"
@@ -410,6 +409,22 @@
410409
></v-text-field>
411410
</v-col>
412411
</v-row>
412+
<v-row
413+
v-if="advanced">
414+
<v-col
415+
cols="12"
416+
md="6"
417+
>
418+
<v-text-field
419+
v-model="docker.command"
420+
:counter="60"
421+
label="Command"
422+
required
423+
bg-color="secondary"
424+
></v-text-field>
425+
</v-col>
426+
</v-row>
427+
</div> <!-- end of deploymentstrategy == docker -->
413428
</v-expansion-panel-text>
414429
</v-expansion-panel>
415430

@@ -1442,6 +1457,7 @@ export default defineComponent({
14421457
docker: {
14431458
image: 'ghcr.io/kubero-dev/idler',
14441459
tag: 'latest',
1460+
command: '',
14451461
},
14461462
autodeploy: true,
14471463
sslIndex: [] as (boolean|undefined)[],
@@ -1893,6 +1909,11 @@ export default defineComponent({
18931909
this.panel.push(8)
18941910
}
18951911
1912+
let command = '';
1913+
if (response.data.spec.image.command) {
1914+
command = response.data.spec.image.command.join(' ');
1915+
}
1916+
18961917
this.security = response.data.spec.image.run.securityContext || {};
18971918
18981919
this.deploymentstrategy = response.data.spec.deploymentstrategy;
@@ -1909,6 +1930,7 @@ export default defineComponent({
19091930
this.imageTag = response.data.spec.imageTag;
19101931
this.docker.image = response.data.spec.image.repository || '';
19111932
this.docker.tag = response.data.spec.image.tag || 'latest';
1933+
this.docker.command = command;
19121934
this.autodeploy = response.data.spec.autodeploy;
19131935
this.envvars = response.data.spec.envVars;
19141936
this.serviceAccount = response.data.spec.serviceAccount;
@@ -2008,6 +2030,13 @@ export default defineComponent({
20082030
this.cleanupIngressAnnotations();
20092031
this.setSSL();
20102032
2033+
let command = [] as string[];
2034+
if (this.docker.command.length > 0) {
2035+
command = this.docker.command.split(' ');
2036+
} else {
2037+
command = [];
2038+
}
2039+
20112040
let postdata = {
20122041
resourceVersion: this.resourceVersion,
20132042
buildpack: this.buildpack,
@@ -2021,6 +2050,7 @@ export default defineComponent({
20212050
containerport: this.containerPort,
20222051
repository: this.docker.image,
20232052
tag: this.docker.tag,
2053+
command: command,
20242054
fetch: this.buildpack?.fetch,
20252055
build: this.buildpack?.build,
20262056
run: this.buildpack?.run,

server/src/modules/application.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export class App implements IApp{
7171
pullPolicy: 'Always',
7272
repository: string,
7373
tag: string,
74+
command: [string],
7475
fetch: {
7576
repository: string,
7677
tag: string,
@@ -175,6 +176,7 @@ export class App implements IApp{
175176
pullPolicy: 'Always',
176177
repository: app.image.repository || 'ghcr.io/kubero-dev/idler',
177178
tag: app.image.tag || 'v1',
179+
command: app.image.command,
178180
fetch: app.image.fetch,
179181
build: app.image.build,
180182
run: app.image.run,

server/src/routes/apps.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ Router.post('/cli/apps', bearerMiddleware, async function (req: Request, res: Re
101101
type: "string",
102102
example: "latest"
103103
},
104+
command: {
105+
type: "string",
106+
example: "npm start"
107+
},
104108
fetch: {
105109
type: "object",
106110
},
@@ -216,6 +220,7 @@ function createApp(req: Request) : IApp {
216220
containerPort: req.body.image.containerport,
217221
repository: req.body.image.repository,
218222
tag: req.body.image.tag || "main",
223+
command: req.body.image.command,
219224
pullPolicy: "Always",
220225
fetch: req.body.image.fetch,
221226
build: req.body.image.build,
@@ -276,6 +281,7 @@ Router.put('/pipelines/:pipeline/:phase/:app', authMiddleware, async function (r
276281
containerPort: req.body.image.containerport,
277282
repository: req.body.image.repository,
278283
tag: req.body.image.tag || "latest",
284+
command: req.body.image.command,
279285
pullPolicy: "Always",
280286
fetch: req.body.image.fetch,
281287
build: req.body.image.build,

server/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface IApp {
1616
image : {
1717
repository: string,
1818
tag: string,
19+
command: [string],
1920
pullPolicy: 'Always',
2021
containerPort: number,
2122
fetch: {

0 commit comments

Comments
 (0)