Skip to content

Commit 727db0b

Browse files
authored
Merge pull request #4649 from project-koku/release_prod-ros.89523
Deployment commit for prod-ros
2 parents b5a23c8 + 8ebc3dd commit 727db0b

File tree

16 files changed

+610
-75
lines changed

16 files changed

+610
-75
lines changed

.github/workflows/tag_release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ on:
44
branches:
55
- prod-hccm
66
- prod-ros
7+
env:
8+
BRANCH: ${{ github.base_ref }}
9+
710
jobs:
811
tag_release:
912
runs-on: ubuntu-latest
1013
steps:
1114
- uses: actions/checkout@v5
1215
with:
13-
ref: ${{ github.head_ref || github.ref_name }}
16+
ref: ${{ env.BRANCH }}
1417
- run: |
1518
git fetch --prune --unshallow
1619
- name: Tag this release
@@ -32,6 +35,6 @@ jobs:
3235
TAG="r.$DATE.$MINOR_VERSION"
3336
git config --local user.email "[email protected]"
3437
git config --local user.name "Cost Management Release Action"
35-
git log $(git tag --list | tail -1)..prod-stable | git tag -a $TAG -F -
38+
git log $(git tag --list | tail -1)..${{ env.BRANCH }} | git tag -a $TAG -F -
3639
git push origin $TAG
3740
shell: bash

.tekton/koku-ui-hccm-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
99
pipelinesascode.tekton.dev/cancel-in-progress: "true"
1010
pipelinesascode.tekton.dev/max-keep-runs: "3"
11-
pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch in ["main", "prod-hccm"]
11+
pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch in ["stage-hccm", "prod-hccm"]
1212
creationTimestamp: null
1313
labels:
1414
appstudio.openshift.io/application: koku-ui-hccm

.tekton/koku-ui-hccm-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
88
pipelinesascode.tekton.dev/cancel-in-progress: "false"
99
pipelinesascode.tekton.dev/max-keep-runs: "3"
10-
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch in ["main", "prod-hccm"]
10+
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch in ["stage-hccm", "prod-hccm"]
1111
creationTimestamp: null
1212
labels:
1313
appstudio.openshift.io/application: koku-ui-hccm

apps/koku-ui-hccm/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ Note that this approach currently supports the Insights stage and prod environme
6262
npm start
6363
```
6464

65-
Follow the prompts that follow.
65+
Follow the prompts below.
6666

67-
* Which platform environment you want to use `stage`
67+
* Which platform environment you want to use? `stage`
6868

6969
2. Open the following URL
7070
```

apps/koku-ui-hccm/RELEASE.md

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,81 @@
22

33
This doc describes how to release Koku UI to each staging environment. Note that this should be done in order for testing purposes.
44

5-
## Release script
5+
## Release branches
66

7-
The release script creates a PR with a unique SHA, used for a namespace \`ref\` in the app-interface repo. The script also ensures that code is always pulled from the correct branches. For example, we always:
7+
The release script creates a koku-ui PR with a unique SHA, used for a namespace \`ref\` in app-interface. The script also ensures that code is always pulled from the correct branches. For example, we always:
88

9-
1. Pull from master when pushing to prod-hccm
9+
1. Pull from master when pushing to stage-hccm
10+
2. Pull from stage-hccm when pushing to prod-hccm
1011

1112
Note: Pushing to master automatically deploys to the stage.
1213

1314
Please allow the PR to build successfully and merge before running the script again.
1415

16+
### Release to stage-hccm
17+
18+
```
19+
sh ../../scripts/release-branch.sh -s
20+
```
21+
1522
### Release to prod-hccm
1623

1724
```
18-
sh scripts/release-branch.sh -p
25+
sh ../../scripts/release-branch.sh -p
1926
```
2027

21-
## Deployment
28+
### Wrapper for all release and deployment functionality
29+
30+
```
31+
node ../../scripts/release-all.js
32+
```
2233

23-
After all PRs have been merged, update the \`koku-ui-hccm\` resource in https://gitlab.cee.redhat.com/service/app-interface/-/blob/master/data/services/insights/hccm/deploy-clowder.yml
34+
Follow the prompts below.
35+
36+
* Which app do you want to release? `koku-ui-hccm`
37+
* Which Chrome environment you want to release? `stage`
38+
* Do you want to release to app-interface? `N`
39+
40+
## Deployments for app-interface
41+
42+
The release script will update app-interface with the latest SHA refs from the koku-ui branches above. The script also ensures that SHA refs are always pulled from the correct branches. For example, we always:
43+
44+
1. Pull from stage-hccm when updating the stage deployment in app-interface
45+
2. Pull from prod-hccm when updating the prod deployment in app-interface
46+
47+
### Release to app-interface
48+
49+
```
50+
sh ../../scripts/release-app-interface.sh -<p|s>
51+
```
52+
53+
### Wrapper for all release and deployment functionality
54+
55+
```
56+
node ../../scripts/release-all.js
57+
```
58+
59+
Follow the prompts below.
60+
61+
* Which app do you want to release? `koku-ui-hccm`
62+
* Which Chrome environment you want to release? `stage`
63+
* Do you want to release to app-interface? `Y`
64+
65+
### Manual deployment
66+
67+
After all koku-ui PRs have been merged, update the \`koku-ui-hccm\` resource in https://gitlab.cee.redhat.com/service/app-interface/-/blob/master/data/services/insights/hccm/deploy-clowder.yml
2468

2569
Use the latest commit of each branch to update namespaces \`ref\` in the app-interface repo. Don't use a merge commit, SHAs must be unique when images are created for each branch.
2670

2771
```
2872
- name: koku-ui-hccm
2973
...
30-
# Prod Stable Deployment
74+
# Stage Deployment
75+
- namespace:
76+
$ref: /services/insights/frontend-operator/namespaces/stage-frontends.yml
77+
ref: 68ce48592f5222029f27f6fb708698013d2f0a58 // Replace with latest SHA for stage-hccm branch
78+
...
79+
# Prod Deployment
3180
- namespace:
3281
$ref: /services/insights/frontend-operator/namespaces/prod-frontends.yml
3382
ref: c7f6c75fd1e895afbc05a2a6d26835fa16a0edfa // Replace with latest SHA for prod-hccm branch

apps/koku-ui-hccm/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
"lint:ts:fix": "eslint src --fix",
2525
"patch:hosts": "fec patch-etc-hosts",
2626
"postinstall": "ts-patch install && rm -rf .cache",
27+
"release:stage": "sh ../../scripts/release-branch.sh -s",
28+
"release:prod": "sh ../../scripts/release-branch.sh -p",
29+
"release:app-interface:stage": "sh ../../scripts/release-app-interface.sh -s",
30+
"release:app-interface:prod": "sh ../../scripts/release-app-interface.sh -p",
2731
"start": "fec dev",
2832
"start:csb": "CLOUD_SERVICES_BACKEND_PORT=8000 npm start",
2933
"start:csb:ros": "FEC_STATIC_PORT=8003 npm run start:csb",

apps/koku-ui-hccm/src/routes/settings/costModels/costModel/sourceTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class SourceTableBase extends React.Component<SourceTableProps, SourceTableState
8686
<Table
8787
onDeleteText={intl.formatMessage(messages.costModelsSourceDelete)}
8888
onDelete={item => {
89-
this.setState({ dialogSource: item[0] });
89+
this.setState({ dialogSource: item?.[0] });
9090
setDialogOpen({ name: 'deleteSource', isOpen: true });
9191
}}
9292
onAdd={() => setDialogOpen({ name: 'addSource', isOpen: true })}

apps/koku-ui-hccm/src/routes/settings/costModels/costModel/table.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,21 @@ interface TableBaseProps extends WrappedComponentProps {
2525
current: CostModel;
2626
}
2727

28-
interface PaginationQuery {
29-
page: number;
30-
perPage: number;
31-
}
32-
3328
interface TableBaseState {
3429
query: { name: string[] };
3530
currentFilter: string;
3631
filter: string;
37-
pagination: PaginationQuery;
3832
}
3933

4034
class TableBase extends React.Component<TableBaseProps, TableBaseState> {
4135
protected defaultState: TableBaseState = {
4236
query: { name: [] },
4337
currentFilter: '',
4438
filter: '',
45-
pagination: { page: 1, perPage: 10 },
4639
};
4740
public state: TableBaseState = { ...this.defaultState };
4841

4942
public render() {
50-
const {
51-
pagination: { page, perPage },
52-
} = this.state;
53-
5443
const { current, intl, isWritePermission, onAdd, rows } = this.props;
5544

5645
const filteredRows = rows
@@ -61,7 +50,6 @@ class TableBase extends React.Component<TableBaseProps, TableBaseState> {
6150
return this.state.query.name.every(fName => uuid.includes(fName));
6251
})
6352
.map(uuid => [uuid]);
64-
const res = filteredRows.slice((page - 1) * perPage, page * perPage);
6553

6654
// Note: Removed pagination props because the /cost-models/{cost_model_uuid}/ API does not support pagination
6755
// See https://issues.redhat.com/browse/COST-2097
@@ -79,12 +67,10 @@ class TableBase extends React.Component<TableBaseProps, TableBaseState> {
7967
filter={{
8068
onClearAll: () =>
8169
this.setState({
82-
pagination: { ...this.state.pagination, page: 1 },
8370
query: { name: [] },
8471
}),
8572
onRemove: (_category, chip) => {
8673
this.setState({
87-
pagination: { ...this.state.pagination, page: 1 },
8874
query: removeMultiValueQuery(this.state.query)('name', chip),
8975
});
9076
},
@@ -102,17 +88,16 @@ class TableBase extends React.Component<TableBaseProps, TableBaseState> {
10288
query: addMultiValueQuery(this.state.query)('name', this.state.currentFilter),
10389
currentFilter: '',
10490
filter: this.state.currentFilter,
105-
pagination: { ...this.state.pagination, page: 1 },
10691
});
10792
},
10893
value: this.state.currentFilter,
10994
placeholder: intl.formatMessage(messages.costModelsFilterPlaceholder),
11095
}}
11196
/>
112-
{res.length > 0 && (
97+
{filteredRows.length > 0 && (
11398
<SourcesTable
11499
showDeleteDialog={(rowId: number) => {
115-
this.props.onDelete(res[rowId]);
100+
this.props.onDelete(filteredRows[rowId]);
116101
}}
117102
showOperatorVersion={getSourceType(current.source_type) === 'OCP'}
118103
/>

apps/koku-ui-onprem/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"private": true,
1010
"scripts": {
1111
"build": "NODE_ENV=production npm run ts-node ../../node_modules/.bin/webpack --mode=production",
12+
"clean": "rimraf dist",
1213
"start": "npm run ts-node ../../node_modules/.bin/webpack serve --mode=development --color --progress",
1314
"lint": "npm-run-all lint:*",
1415
"lint:ts": "eslint src",

apps/koku-ui-ros/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ npm start
6464

6565
Follow the prompts that follow.
6666

67-
* Which platform environment you want to use `stage`
67+
* Which platform environment you want to use? `stage`
6868

6969
2. Open the following URL
7070
```

0 commit comments

Comments
 (0)