Skip to content

Commit bbd9707

Browse files
v24.9.0 (#2)
* fix: naming * feat: update .todos * feat: update .todos
1 parent 1994d3f commit bbd9707

File tree

6 files changed

+61
-14
lines changed

6 files changed

+61
-14
lines changed

.env.group.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TF_TOKEN_app_terraform_io=
2+
3+
AWS_ACCESS_KEY_ID=
4+
AWS_SECRET_ACCESS_KEY=
5+
AWS_DEFAULT_REGION=

tln.conf.template renamed to .tln.conf.template

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const envs = {
121121
const components = [
122122
{ id: 'web/landing', proxy: false, ecr: 'web.landing', image: true, migrations: false },
123123
// { id: 'backend/services/', proxy: false, ecr: 'backend.services.core', image: true, migrations: true },
124-
]
124+
];
125125

126126
const getComponents = (env, filter = (v) => !v.proxy, log = false ) => {
127127
const ref = env.MYPROJECT_REPO_REF;
@@ -192,6 +192,8 @@ module.exports = {
192192
env.TLN_UID = domains.prod.split('.').reverse().join('.');
193193
env.TLN_VERSION = fs.readFileSync(path.join(__dirname, 'version'), 'utf8').trim();
194194

195+
env.MYPROJECT_SHA1 = exec("git log -1 --format='format:%h %s'").toString().trim().substring(0, 30);
196+
195197
env.MYPROJECT_CLOUD_PROVIDER = 'aws';
196198
env.MYPROJECT_CLOUD_PROVIDER_ACCOUNT = account;
197199
env.MYPROJECT_K8S_NAMESPACE = context.replace(':', '-');
@@ -235,17 +237,23 @@ module.exports = {
235237
}).filter(item => !!item).join(',');
236238

237239
// Extract db, user, passsword from env vars and prepare input for Terraform
240+
const connStrParcer = (conn) => {
241+
if (conn) {
242+
const dbu = conn.match(/\?user=(.*)\&/)[1];
243+
const p = conn.match(/\&password=(.*)/)[1];
244+
const p1 = dbu.split('-');
245+
return { db: p1[0], user: p1[1], password: p };
246+
}
247+
}
238248
const databases = [
239249
//'MYPROJECT_PG_CONNECTION_STRING',
240250
].map( v => {
241251
const conn = env[v];
242-
const dbu = conn.match(/\?user=(.*)\&/)[1];
243-
const p = conn.match(/\&password=(.*)/)[1];
244-
const p1 = dbu.split('-');
245-
//console.log(dbu, p, p1[0], p1[1]);
246-
return `"${p1[0]}" = { owner = "${p1[1]}", password = "${p}" }`;
252+
if (conn) {
253+
const {db, user, password} = connStrParcer(conn);
254+
return `"${db}" = { owner = "${user}", password = "${password}" }`;
255+
}
247256
}).join(', ');
248-
249257
env.TF_VAR_databases = `{ ${databases} }`;
250258
//console.log(env.TF_VAR_databases);
251259
//env.TF_VAR_databases = `{ "user" = { owner = "admin", password = "admin" }, "balance" = { owner = "admin", password = "admin" } }`;
@@ -266,7 +274,7 @@ module.exports = {
266274
];
267275
},
268276
inherits: async (tln) => [],
269-
depends: async (tln) => [],
277+
depends: async (tln) => ['aws-cli-2.17.9'],
270278
steps: async (tln) =>
271279
[
272280
['init', 'init:link', '', ''],
@@ -303,6 +311,7 @@ module.exports = {
303311
//`tln install ${['platform', 'env', script.env.MYPROJECT_CLOUD_PROVIDER].join('/')} --depends`,
304312
//`tln install ${['platform', 'app'].join('/')} --depends`,
305313
//`tln install ${['platform', 'tenant'].join('/')} --depends`,
314+
//`tln exec -c 'aws --version'`,
306315
//`tln exec platform/env/aws -c 'aws ecr get-login-password | docker login --username AWS --password-stdin ${script.env.TLN_DOCKER_REGISTRY}'`
307316
]));
308317
}

.todo

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* TPM
2+
3+
team:
4+
vlad.k:
5+
email: vladislav.kurmaz@gmail.com
6+
7+
timeline:
8+
v24.9.0:
9+
date: 2024-09-24
10+
v24.10.0:
11+
date: 2024-10-xx
12+
13+
tasks: |-
14+
[-:003:v24.10.0] @vlad.k Create repository to test CI/CD skeleton
15+
[-:002:v24.10.0] @vlad.k Split prereq & login command
16+
[+:001:v24.9.0] @vlad.k Set default env in base.yml - '', dispatch/push - dev01
17+
18+
*/

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
# tln-cicd-github
1+
# tln-cicd-github
2+
CI/CD skeleton
3+
4+
## Integration
5+
* Add this repository using git subtree (execute from the root of the repository and add into main branch using merge commit)
6+
```
7+
tln subtree-add -- --prefix .github/workflows --subtree https://github.com/project-talan/tln-cicd-github.git --ref v24.9.0 --squash
8+
```
9+
* Install Nodejs libraries (execute next command from the root of the repository)
10+
```
11+
npm i js-yaml assign-deep fast-glob --save
12+
```
13+
* Copy .github/workflows/.tln.conf.template to the repository root and update it with actuail values: project name, terraform cloud parameters, AWS account etc.
14+
```
15+
cp .github/workflows/.tln.conf.template .tln.conf
16+
```

base.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
environment:
1818
type: string
1919
description: Environment
20-
default: "ci"
20+
default: ""
2121
tests:
2222
type: string
2323
description: Tests
@@ -63,7 +63,7 @@ jobs:
6363
with:
6464
node-version: "22.6.0"
6565

66-
- run: npm i -g tln-cli@1.104.0
66+
- run: npm i -g tln-cli@1.104.0 tln-pm@0.2.0
6767

6868
- uses: actions/checkout@v4
6969
with:
@@ -84,7 +84,7 @@ jobs:
8484
large-packages: true
8585
docker-images: false
8686
swap-storage: true
87-
87+
8888
- name: Configure environment
8989
env:
9090
ENVIRONMENT_GROUP: ${{ secrets.ENVIRONMENT_GROUP }}
@@ -96,7 +96,7 @@ jobs:
9696
9797
mkdir secrets
9898
echo "$ENVIRONMENT_GROUP" > secrets/.env.${{ inputs.group }}
99-
tln configure-ci:prereq:get-secrets
99+
tln configure-ci:get-secrets:prereq
100100
ls -la secrets
101101
102102
- name: Init

dispatch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
environment:
1111
type: string
1212
description: Environment
13-
default: ci
13+
default: dev01
1414
tests:
1515
type: string
1616
description: Tests unit, spec, static, blind, api, ui, load

0 commit comments

Comments
 (0)