Skip to content

Commit

Permalink
feat: Add GitLab support to report_build_status and build_status_conf…
Browse files Browse the repository at this point in the history
…ig for aws_codebuild_project
  • Loading branch information
acwwat committed Apr 17, 2024
1 parent a680053 commit 16e1fa4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/36942.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_codebuild_project: Add GitLab and GitLab Self Managed support to the `report_build_status` and `build_status_config` arguments
```
14 changes: 7 additions & 7 deletions internal/service/codebuild/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -1563,14 +1563,14 @@ func expandProjectSource(tfMap map[string]interface{}) *types.ProjectSource {
apiObject.SourceIdentifier = aws.String(v)
}

// Only valid for BITBUCKET, GITHUB, and GITHUB_ENTERPRISE source types, e.g.
// InvalidInputException: Source type NO_SOURCE does not support ReportBuildStatus
if sourceType == types.SourceTypeBitbucket || sourceType == types.SourceTypeGithub || sourceType == types.SourceTypeGithubEnterprise {
// Only valid for BITBUCKET, GITHUB, GITHUB_ENTERPRISE, GITLAB, and GITLAB_SELF_MANAGED source types
// e.g., InvalidInputException: Source type NO_SOURCE does not support ReportBuildStatus
if sourceType == types.SourceTypeBitbucket || sourceType == types.SourceTypeGithub || sourceType == types.SourceTypeGithubEnterprise || sourceType == types.SourceTypeGitlab || sourceType == types.SourceTypeGitlabSelfManaged {
apiObject.ReportBuildStatus = aws.Bool(tfMap["report_build_status"].(bool))
}

// Only valid for CODECOMMIT, GITHUB, GITHUB_ENTERPRISE, BITBUCKET source types.
if sourceType == types.SourceTypeCodecommit || sourceType == types.SourceTypeGithub || sourceType == types.SourceTypeGithubEnterprise || sourceType == types.SourceTypeBitbucket {
// Only valid for BITBUCKET, CODECOMMIT, GITHUB, and GITHUB_ENTERPRISE source types
if sourceType == types.SourceTypeBitbucket || sourceType == types.SourceTypeCodecommit || sourceType == types.SourceTypeGithub || sourceType == types.SourceTypeGithubEnterprise {
if v, ok := tfMap["git_submodules_config"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
tfMap := v[0].(map[string]interface{})

Expand All @@ -1584,8 +1584,8 @@ func expandProjectSource(tfMap map[string]interface{}) *types.ProjectSource {
}
}

// Only valid for BITBUCKET, GITHUB, GITHUB_ENTERPRISE source types.
if sourceType == types.SourceTypeBitbucket || sourceType == types.SourceTypeGithub || sourceType == types.SourceTypeGithubEnterprise {
// Only valid for BITBUCKET, GITHUB, GITHUB_ENTERPRISE, GITLAB, and GITLAB_SELF_MANAGED source types
if sourceType == types.SourceTypeBitbucket || sourceType == types.SourceTypeGithub || sourceType == types.SourceTypeGithubEnterprise || sourceType == types.SourceTypeGitlab || sourceType == types.SourceTypeGitlabSelfManaged {
if v, ok := tfMap["build_status_config"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
tfMap := v[0].(map[string]interface{})

Expand Down
12 changes: 6 additions & 6 deletions website/docs/r/codebuild_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ See [ProjectFileSystemLocation](https://docs.aws.amazon.com/codebuild/latest/API
* `git_submodules_config` - (Optional) Configuration block. Detailed below.
* `insecure_ssl` - (Optional) Ignore SSL warnings when connecting to source control.
* `location` - (Optional) Location of the source code from git or s3.
* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is only valid when your source provider is `GITHUB`, `BITBUCKET`, or `GITHUB_ENTERPRISE`.
* `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is `GITHUB`, `GITHUB_ENTERPRISE`, or `BITBUCKET`. `build_status_config` blocks are documented below.
* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is valid only when your source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket.
* `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. `build_status_config` blocks are documented below.
* `source_identifier` - (Required) An identifier for this project source. The identifier can only contain alphanumeric characters and underscores, and must be less than 128 characters in length.
* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `BITBUCKET` or `S3`.
* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `BITBUCKET`, `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, `GITLAB_SELF_MANAGED`, `NO_SOURCE`, `S3`.

#### secondary_sources: git_submodules_config

This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`.
This block is only valid when the `type` is `CODECOMMIT`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, or `GITLAB_SELF_MANAGED`.

* `fetch_submodules` - (Required) Whether to fetch Git submodules for the AWS CodeBuild build project.

Expand All @@ -385,13 +385,13 @@ This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_EN
* `git_submodules_config` - (Optional) Configuration block. Detailed below.
* `insecure_ssl` - (Optional) Ignore SSL warnings when connecting to source control.
* `location` - (Optional) Location of the source code from git or s3.
* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is only valid when the `type` is `BITBUCKET` or `GITHUB`.
* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is valid only when your source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket.
* `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. `build_status_config` blocks are documented below.
* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `BITBUCKET`, `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, `GITLAB_SELF_MANAGED`, `NO_SOURCE`, `S3`.

#### source: git_submodules_config

This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`.
This block is only valid when the `type` is `CODECOMMIT`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, or `GITLAB_SELF_MANAGED`.

* `fetch_submodules` - (Required) Whether to fetch Git submodules for the AWS CodeBuild build project.

Expand Down

0 comments on commit 16e1fa4

Please sign in to comment.