Skip to content

Commit

Permalink
feat: consume pulumi environment (#99)
Browse files Browse the repository at this point in the history
* feat: consume pulumi environment

* fix: don't nest

* feat: add environment to core-infra

* feat: get github token from environment instead of bjerk bot

* fix: refer to github config when retrieving values

* fix: import github token

* fix: update dead repository reference

* fix: remove basssene

* fix: revert bassene nuking

* fix: remove bassene

* feat: retrieve tokens for individual orgs
  • Loading branch information
braaar committed Jan 10, 2024
1 parent 0a10b0a commit 424b66d
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 50 deletions.
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions projects/bjerk-conf/Pulumi.prod.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
config:
environment:
- secrets
8 changes: 6 additions & 2 deletions projects/bjerk-conf/resources/github/providers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as github from '@pulumi/github';
import { bjerkBotGitHubToken as token } from '../stack-refs';
import * as pulumi from '@pulumi/pulumi';
import { getToken } from 'get-pulumi-secret';

const githubProviders = new Map<string, github.Provider>();

Expand All @@ -9,7 +10,10 @@ export function getGithubProvider(owner: string): github.Provider {
owner,
new github.Provider(owner, {
owner,
token,
token: getToken({
name: `${owner}-token`,
namespace: 'github',
}),
}),
);
}
Expand Down
7 changes: 0 additions & 7 deletions projects/bjerk-conf/resources/stack-refs.ts

This file was deleted.

2 changes: 2 additions & 0 deletions projects/bjerk-io/Pulumi.prod.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
config:
gcp:project: bjerk-io
environment:
- secrets
6 changes: 4 additions & 2 deletions projects/bjerk-io/src/github.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as github from '@pulumi/github';
import { bjerkBotGitHubToken } from './stack-refs';
import * as pulumi from '@pulumi/pulumi';

const config = new pulumi.Config('github');

export const githubProvider = new github.Provider('gh-provider', {
owner: 'bjerkio',
token: bjerkBotGitHubToken,
token: config.requireSecret('token'),
});
7 changes: 0 additions & 7 deletions projects/bjerk-io/src/stack-refs.ts

This file was deleted.

4 changes: 2 additions & 2 deletions projects/core-infra/Pulumi.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ config:
- group:gcp-organization-viewers@bjerk.io
branches:developers:
- group:developers@bjerk.io
github:token:
secure: AAABAFV2iNVa8uYxniCjg8903NVjQG4b9K6N4gcPlraAaszUTxUmkcft/IQm0j2NeqbTBGWH2Ei7xrtPpShS2hwaHHGE12rz
intg-avfnor:slack-channel: C03KE9E4QEQ
pulumi:token:
secure: AAABALfUIspDSD6BHc//gBuigJQpEPekvfyM5HhY3UZdRov/qkl2Jams+B4BQmmaPUZeO4qWiyk/2ymYEiIOTmYvidWSLKKqM4ioUg==
Expand All @@ -20,3 +18,5 @@ config:
slack:google-cloud-logger-slack-tag: latest
timely-agent:slack-channel: C03BY6RB248
tripletex-time-agent:slack-channel: C03J6TVRVFG
environment:
- secrets
3 changes: 2 additions & 1 deletion projects/core-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"@pulumi/github": "^5.8.0",
"@pulumi/pulumi": "^3.65.1",
"date-fns": "^2.30.0",
"gcl-slack": "^3.0.0"
"gcl-slack": "^3.0.0",
"get-pulumi-secret": "^2.0.0"
},
"devDependencies": {
"@types/node": "^18.16.3",
Expand Down
3 changes: 3 additions & 0 deletions projects/core-infra/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ export const branchesDevelopers =
export const developers = config.requireObject<string[]>('developers');
export const internalViewers =
config.requireObject<string[]>('internal-viewers');

const githubConfig = new pulumi.Config('github');
export const githubToken = githubConfig.requireSecret('token');
13 changes: 0 additions & 13 deletions projects/core-infra/src/customers/bassene-web.ts

This file was deleted.

1 change: 0 additions & 1 deletion projects/core-infra/src/customers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import './bassene-web';
import './flexisoft';
import './abax-vwfs';
7 changes: 1 addition & 6 deletions projects/core-infra/src/github-orgs.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import * as github from '@pulumi/github';
import { bjerkBotGitHubToken as token } from './stack-refs';
import { githubToken as token } from './config';

export const bjerkio = new github.Provider('bjerkio-provider', {
owner: 'bjerkio',
token,
});

export const basssene = new github.Provider('basssene-provider', {
owner: 'basssene',
token,
});

export const branches = new github.Provider('branches-provider', {
owner: 'getbranches',
token,
Expand Down
4 changes: 2 additions & 2 deletions projects/core-infra/src/providers/github.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as github from '@pulumi/github';
import { bjerkBotGitHubToken } from '../stack-refs';
import { githubToken } from '../config';

export const provider = new github.Provider('github-provider', {
token: bjerkBotGitHubToken,
token: githubToken,
});
7 changes: 0 additions & 7 deletions projects/core-infra/src/stack-refs.ts

This file was deleted.

0 comments on commit 424b66d

Please sign in to comment.