@refreshly/gitlab
This is both a source and a target module! The source rotates the GitLab token you provide it. Whereas the target deploys your keys to GitLab CI / CD Variables.
Usage
As a Source
import { Refreshly, DotEnv } from '@refreshly/core';
import { GitLab } from '@refreshly/gitlab';
Refreshly(
new GitLab.Source({
token: myGitLabToken, // process.env.GL_TOKEN || process.env.GITLAB_TOKEN
targets: [
new DotEnv.Target({
file: '.env',
}),
],
})
);
As a Target
import { Refreshly, DotEnv } from '@refreshly/core';
import { GitLab } from '@refreshly/gitlab';
Refreshly(
new DotEnv.Source({
file: '.env',
targets: [
new GitLab.Target({
token: myGitLabToken, // process.env.GL_TOKEN || process.env.GITLAB_TOKEN
ids: ['<your-group-or-project-id>'],
}),
],
})
);
Caveats
GitLab doesn't really support deferring the deletion of the old token. This results in a few issues...
We can't revert to the old token if a failure occurs
We have to update the environment variable so that 'Gitlab.Target' can pick it up.
As an aside, GitLab DOES have a create token endpoint, however its only usable by server admins making it effectively useless
Last updated