-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
|
||
import program from 'commander'; | ||
import { getConf } from './lib/utils'; | ||
import { savePropertiesFile } from './lib/properties-file'; | ||
import gitlabCI from './lib/gitlab-ci'; | ||
|
||
async function execute() { | ||
const conf = await getConf(); | ||
|
||
const handler = gitlabCI(conf.url, conf.token); | ||
const resp = await handler.listVariables(); | ||
|
||
console.log('Downloaded variables from Gitlab CI.'); | ||
|
||
savePropertiesFile(`${process.cwd()}/conf.out`, resp); | ||
|
||
console.log(`Saved variables to ${conf.out}`); | ||
|
||
return resp; | ||
} | ||
|
||
program | ||
.description('Read all key/value pairs from Gitlab API and saves them to the specified .yml file') | ||
.option( | ||
'--url <url>', | ||
'Your Gitlab project URL, e.g. https://gitlab.com/gitlab-org/gitlab-ce', | ||
) | ||
.option( | ||
'--token <token>', | ||
'Your Gitlab token.', | ||
) | ||
.option( | ||
'--out <out>', | ||
'The location to save CI values to.', | ||
'gitlab.env.yml', | ||
) | ||
.parse(process.argv); | ||
|
||
execute(program); |