Skip to content

Commit

Permalink
Prettified Code!
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops authored and actions-user committed Jul 31, 2024
1 parent f4929d8 commit d8820d7
Show file tree
Hide file tree
Showing 47 changed files with 1,031 additions and 704 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: Bug
about: An undesirable behaviour that needs correction
title: Bug
labels: ''
assignees: ''

labels: ""
assignees: ""
---

**Describe the Bug**
Expand All @@ -22,6 +21,7 @@ A clear and concise description of any implications.
**Steps To Reproduce**
Steps to reproduce the behaviour:
User/Role:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand Down
15 changes: 9 additions & 6 deletions .github/ISSUE_TEMPLATE/spike.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
name: Spike
about: Research options prior to development work
title: Spike
labels: ''
assignees: ''

labels: ""
assignees: ""
---

**Problem Description**
**Problem Description**
**In order to** (achieve some goal), (a system or persona) **needs to** (some action).

**Solution Needs**

- Enter the non-negotiables of the solution (what are the needs vs. what are the wants)

**Timebox**

- How much effort are we committing to this research?

**Outcome**
Details describing the outcome of the research
- Was it successful? What direction should the work go?
Details describing the outcome of the research

- Was it successful? What direction should the work go?
- Was it unsuccessful? Discuss next steps with team

**Additional Context**

- enter text here
- enter text here
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: Task
about: Any work that does not directly impact the user
title: Task
labels: ''
assignees: ''

labels: ""
assignees: ""
---

**Describe the task**
Expand All @@ -14,10 +13,12 @@ A clear and concise description of what the task is.
The reason why this task is needed and/or what value it adds.

**Acceptance Criteria**

- [ ] first
- [ ] second
- [ ] third

**Additional context**

- Add any other context about the task here.
- Or here
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/user-story.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
name: User Story
about: This template is to be used when describing a feature from the user's perspective
title: User Story
labels: ''
assignees: ''

labels: ""
assignees: ""
---

**Title:**

**Description:**

- [ ] "As a [type of user]" "I want [an action or feature]" "So that [benefit or value]" -

**Wireframe:** <link>
Expand All @@ -22,6 +22,7 @@ assignees: ''
- [ ] Given I am a <role>, When I am <doing something>, then <this happens>

**Development Checklist:**

- [ ] A
- [ ] B
- [ ] C
Expand Down
8 changes: 4 additions & 4 deletions .pipeline/build-metabase.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const task = require('./lib/build-metabase.js')
const settings = require('./lib/config.js')
"use strict";
const task = require("./lib/build-metabase.js");
const settings = require("./lib/config.js");

task(Object.assign(settings, { phase: 'build'}))
task(Object.assign(settings, { phase: "build" }));
8 changes: 4 additions & 4 deletions .pipeline/build-patroni.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const task = require('./lib/build-patroni.js')
const settings = require('./lib/config.js')
"use strict";
const task = require("./lib/build-patroni.js");
const settings = require("./lib/config.js");

task(Object.assign(settings, { phase: 'build'}))
task(Object.assign(settings, { phase: "build" }));
8 changes: 4 additions & 4 deletions .pipeline/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const task = require('./lib/build.js')
const settings = require('./lib/config.js')
"use strict";
const task = require("./lib/build.js");
const settings = require("./lib/config.js");

task(Object.assign(settings, { phase: 'build'}))
task(Object.assign(settings, { phase: "build" }));
8 changes: 4 additions & 4 deletions .pipeline/clean-tools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/clean-tools.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/clean-tools.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
8 changes: 4 additions & 4 deletions .pipeline/clean.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/clean.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/clean.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
8 changes: 4 additions & 4 deletions .pipeline/deploy-knp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/deploy-knp.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/deploy-knp.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
8 changes: 4 additions & 4 deletions .pipeline/deploy-metabase.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/deploy-metabase.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/deploy-metabase.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
8 changes: 4 additions & 4 deletions .pipeline/deploy-patroni.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/deploy-patroni.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/deploy-patroni.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
8 changes: 4 additions & 4 deletions .pipeline/deploy-unittest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/deploy-unittest.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/deploy-unittest.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
8 changes: 4 additions & 4 deletions .pipeline/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const settings = require('./lib/config.js')
const task = require('./lib/deploy.js')
"use strict";
const settings = require("./lib/config.js");
const task = require("./lib/deploy.js");

task(Object.assign(settings, { phase: settings.options.env}));
task(Object.assign(settings, { phase: settings.options.env }));
17 changes: 13 additions & 4 deletions .pipeline/lib/build-metabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
const { OpenShiftClientX } = require("@bcgov/pipeline-cli");
const path = require("path");

module.exports = settings => {
module.exports = (settings) => {
const phases = settings.phases;
const options = settings.options;
const oc = new OpenShiftClientX(Object.assign({ namespace: phases.build.namespace }, options));
const oc = new OpenShiftClientX(
Object.assign({ namespace: phases.build.namespace }, options),
);
const phase = "build";
let objects = [];
const templatesLocalBaseUrl = oc.toFileUrl(path.resolve(__dirname, "../../openshift"));
const templatesLocalBaseUrl = oc.toFileUrl(
path.resolve(__dirname, "../../openshift"),
);

// The building of your cool app goes here ▼▼▼
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/metabase/metabase-bc.yaml`, {}));
objects = objects.concat(
oc.processDeploymentTemplate(
`${templatesLocalBaseUrl}/templates/metabase/metabase-bc.yaml`,
{},
),
);

oc.applyRecommendedLabels(
objects,
Expand Down
17 changes: 13 additions & 4 deletions .pipeline/lib/build-patroni.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
const { OpenShiftClientX } = require("@bcgov/pipeline-cli");
const path = require("path");

module.exports = settings => {
module.exports = (settings) => {
const phases = settings.phases;
const options = settings.options;
const oc = new OpenShiftClientX(Object.assign({ namespace: phases.build.namespace }, options));
const oc = new OpenShiftClientX(
Object.assign({ namespace: phases.build.namespace }, options),
);
const phase = "build";
let objects = [];
const templatesLocalBaseUrl = oc.toFileUrl(path.resolve(__dirname, "../../openshift"));
const templatesLocalBaseUrl = oc.toFileUrl(
path.resolve(__dirname, "../../openshift"),
);

// The building of your cool app goes here ▼▼▼
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/patroni-2.1.1/templates/build.yaml`, {}));
objects = objects.concat(
oc.processDeploymentTemplate(
`${templatesLocalBaseUrl}/templates/patroni-2.1.1/templates/build.yaml`,
{},
),
);

oc.applyRecommendedLabels(
objects,
Expand Down
56 changes: 35 additions & 21 deletions .pipeline/lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,51 @@
const { OpenShiftClientX } = require("@bcgov/pipeline-cli");
const path = require("path");

module.exports = settings => {
module.exports = (settings) => {
const phases = settings.phases;
const options = settings.options;
const oc = new OpenShiftClientX(Object.assign({ namespace: phases.build.namespace }, options));
const oc = new OpenShiftClientX(
Object.assign({ namespace: phases.build.namespace }, options),
);
const phase = "build";
let objects = [];
const templatesLocalBaseUrl = oc.toFileUrl(path.resolve(__dirname, "../../openshift"));
const templatesLocalBaseUrl = oc.toFileUrl(
path.resolve(__dirname, "../../openshift"),
);

// The building of your cool app goes here ▼▼▼

// build frontend
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-bc.yaml`, {
'param':{
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix,
'VERSION': phases[phase].tag,
'GIT_URL': oc.git.http_url,
'GIT_REF': oc.git.ref
}
}))
objects = objects.concat(
oc.processDeploymentTemplate(
`${templatesLocalBaseUrl}/templates/frontend/frontend-bc.yaml`,
{
param: {
NAME: phases[phase].name,
SUFFIX: phases[phase].suffix,
VERSION: phases[phase].tag,
GIT_URL: oc.git.http_url,
GIT_REF: oc.git.ref,
},
},
),
);

//build backend
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/backend/backend-bc.yaml`, {
'param':{
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix,
'VERSION': phases[phase].tag,
'GIT_URL': oc.git.http_url,
'GIT_REF': oc.git.ref
}
}))
objects = objects.concat(
oc.processDeploymentTemplate(
`${templatesLocalBaseUrl}/templates/backend/backend-bc.yaml`,
{
param: {
NAME: phases[phase].name,
SUFFIX: phases[phase].suffix,
VERSION: phases[phase].tag,
GIT_URL: oc.git.http_url,
GIT_REF: oc.git.ref,
},
},
),
);

oc.applyRecommendedLabels(
objects,
Expand Down
14 changes: 7 additions & 7 deletions .pipeline/lib/clean-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ const getTargetPhases = (env, phases) => {
return target_phase;
};

module.exports = settings => {
module.exports = (settings) => {
const phases = settings.phases;
const options = settings.options;
const oc = new OpenShiftClientX(Object.assign({ namespace: phases.build.namespace }, options));
const oc = new OpenShiftClientX(
Object.assign({ namespace: phases.build.namespace }, options),
);
const target_phases = getTargetPhases(options.env, phases);

target_phases.forEach(k => {
target_phases.forEach((k) => {
if (phases.hasOwnProperty(k)) {

const phase = phases[k];
oc.namespace(phase.namespace);

Expand All @@ -44,7 +45,7 @@ module.exports = settings => {
namespace: phase.namespace,
});

buildConfigs.forEach(bc => {
buildConfigs.forEach((bc) => {
if (bc.spec.output.to.kind == "ImageStreamTag") {
oc.delete([`ImageStreamTag/${bc.spec.output.to.name}`], {
"ignore-not-found": "true",
Expand All @@ -56,9 +57,8 @@ module.exports = settings => {
"ignore-not-found": "true",
wait: "true",
namespace: phase.namespace,
});
});
});

}
});
};
Loading

0 comments on commit d8820d7

Please sign in to comment.