Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: GitLab CI model and base classes #1357

Merged
merged 23 commits into from
Jan 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2b798d8
feat: GitLab CI model and base classes
dontirun Dec 20, 2021
dd93cc1
adding missing descriptions
dontirun Dec 20, 2021
9c41224
docs: updated API docs
dontirun Dec 20, 2021
1e83535
chore: moving nested ci templates to .gitlab subfolder
dontirun Dec 21, 2021
d0f34e0
docs: fixing docstring formatting and descriptions
dontirun Dec 28, 2021
d047c75
chore: removing comments for deprecated global-types. https://docs.gi…
dontirun Dec 28, 2021
a9c83f8
fix: addServices inputs and equality checking
dontirun Dec 28, 2021
6d42ed0
chore: moving some configuration options to construction time
dontirun Dec 28, 2021
26866b2
chore: change to allow for configuration options of nested templates
dontirun Dec 28, 2021
3267497
style: linting fixes
dontirun Dec 28, 2021
41c2533
docs: API update
dontirun Dec 28, 2021
cee5171
refactor: changing configuration 'default', 'workflow', and 'pages' p…
dontirun Dec 28, 2021
cae673e
chore: constructor for CiConfiguration now removes fileextentions fro…
dontirun Dec 28, 2021
e2ec610
docs: Adding GitLab documentation
dontirun Dec 28, 2021
8124b47
Apply suggestions from code review
dontirun Dec 29, 2021
c5cde34
chore: Removing union types from interfaces when possible, updating a…
dontirun Dec 29, 2021
7018e3b
docs: API updates
dontirun Dec 29, 2021
e7ec823
chore: seperating default property into different subproperties for C…
dontirun Dec 29, 2021
2fabdac
Apply suggestions from code review
dontirun Dec 30, 2021
db83fb6
docs: fix docstring indent
dontirun Dec 30, 2021
b85f20e
chore: refactoring isValidInclude into assertion method assertIsValid…
dontirun Dec 30, 2021
da8c3ae
format code
dontirun Jan 2, 2022
60bc5ff
docs: API docs update
dontirun Jan 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Christopher Rybicki <crybicki98@gmail.com>
  • Loading branch information
dontirun and Chriscbr authored Dec 29, 2021
commit 8124b47611c9f63e7d79cf391b86964ede98bdc2
4 changes: 2 additions & 2 deletions docs/gitlab.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# GitLab

[GitLab CI/CD](https://docs.gitlab.com/ee/ci/yaml/gitlab_ci_yaml.html) uses a `.gitlab-ci.yml` configuration located in the root of your repository. Optionally `.gitlab-ci.yml` files can be split into multiple files to increase readability, or reduce duplication of the same configuration in multiple places by using [include](https://docs.gitlab.com/ee/ci/yaml/#include).
[GitLab CI/CD](https://docs.gitlab.com/ee/ci/yaml/gitlab_ci_yaml.html) uses a `.gitlab-ci.yml` file located at the root of your repository to specify continuous integration and continuous deployment processes. GitLab CI configuration files can be split into multiple files using the [include](https://docs.gitlab.com/ee/ci/yaml/#include) fields in order to increase readability or reduce duplication of the same configuration in multiple places.

## Creating a configuration

We support the creation of GitLab CI/CD Configurations through a `CiConfiguration` class and a higher level `GitlabConfiguration` and `NestedConfiguration` classes. To create a GitLab configuration you must first create a [project](./project.md) to assign the configuration to.

When using any of the `gitlab` classes. The `.gitlab-ci.yml` is always located at the root of the project while other configuration files are located in the `.gitlab\ci-templates\` subdirectory.
When using GitLab for CI, the `.gitlab-ci.yml` is always located at the root of the project while other configuration files are located in the `.gitlab\ci-templates\` subdirectory.

```js
const { typescript, gitlab } = require('projen');
Expand Down
6 changes: 3 additions & 3 deletions src/gitlab/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class CiConfiguration extends Component {
* The workflow YAML file.
*/
public readonly file: YamlFile;
public default?: Default;
public readonly default?: Default;
/**
* Can be `Include` or `Include[]`. Each `Include` will be a string, or an
* object with properties for the method if including external YAML file. The external
Expand All @@ -54,15 +54,15 @@ export class CiConfiguration extends Component {
* A special job used to upload static sites to Gitlab pages. Requires a `public/` directory
* with `artifacts.path` pointing to it.
*/
public pages?: Job;
public readonly pages?: Job;
public readonly services: Array<Service | string> = [];
/**
* Groups jobs into stages. All jobs in one stage must complete before next stage is
* executed. Defaults to ['build', 'test', 'deploy'].
*/
public readonly stages: string[] = [];
public readonly variables: Record<string, number | VariableConfig | string> = {};
public workflow?: Workflow;
public readonly workflow?: Workflow;
public readonly jobs: Record<string, Job> = {};

constructor(project: Project, name: string, options?: CiConfigurationOptions) {
Expand Down