Skip to content

Commit

Permalink
fixes #81 - add gitlab source for codebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
techthoughts2 committed May 10, 2024
1 parent 3bb9914 commit a9db354
Show file tree
Hide file tree
Showing 19 changed files with 1,551 additions and 18 deletions.
4 changes: 3 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.8.0]
## [2.9.0]

- Catesta template module changes
- CI/CD Changes:
- AWS:
- GitLab added as a supported source for CodeBuild projects
- Each CodeBuild project now has its own `AWS::Logs::LogGroup` created with a configurable retention policy.
- Minor changes to formatting in CFNs to satisfy new `cfn-lint` requirements.
- Windows CodeBuild project containers upgraded to latest image:
Expand All @@ -34,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PSScriptAnalyzer bumped from `1.21.0` to `1.22.0`
- Documentation updates
- Updated README to use new badge urls for action builds
- Updated Catesta - AWS CodeBuild Integration

## [2.4.0]

Expand Down
2 changes: 1 addition & 1 deletion docs/Catesta.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Name: Catesta
Module Guid: 6796b193-9013-468a-b022-837749af2d06
Download Help Link: NA
Help Version: 2.8.0
Help Version: 2.9.0
Locale: en-US
---

Expand Down
Binary file modified docs/assets/AWS/AWSCodeBuildBitbucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/AWS/AWSCodeBuildGitHub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/AWS/AWSCodeBuildGitLab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/catesta_cicd_integrations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
165 changes: 164 additions & 1 deletion docs/assets/diagrams/catesta_aws_codebuild_bitbucket.drawio

Large diffs are not rendered by default.

159 changes: 158 additions & 1 deletion docs/assets/diagrams/catesta_aws_codebuild_github.drawio

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions docs/assets/diagrams/catesta_aws_codebuild_gitlab.drawio

Large diffs are not rendered by default.

304 changes: 303 additions & 1 deletion docs/assets/diagrams/catesta_cicd_integrations.drawio

Large diffs are not rendered by default.

49 changes: 39 additions & 10 deletions docs/catesta_cicd/Catesta-AWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,33 @@ Scaffolds a new PowerShell module or vault project intended for CI/CD workflow u

CodeBuild Supported Builds:

![Cross Platform](https://img.shields.io/badge/Builds-Windows%20PowerShell%20%7C%20Windows%20pwsh%20%7C%20Linux%20%7C%20MacOS-lightgrey)
![Cross Platform](https://img.shields.io/badge/Builds-Windows%20PowerShell%20%7C%20Windows%20pwsh%20%7C%20Linux-lightgrey)

-------------------

1. You will [need an AWS Account](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/).
1. Create your project using Catesta and select `[C] AWS CodeBuild` at the CICD prompt. *([Catesta Basics](../Catesta-Basics.md))*
* *Note: You will see the following prompt unique to the AWS CodeBuild selection:*
* **Enter S3 bucket name to download needed PS modules from S3 location. Leave blank to DL modules from PSGallery.** Your CodeBuild instance will need various modules to successfully build your PowerShell module project. By default, it does not contain them. Leaving this blank will default to having the CodeBuild instance download and install the needed modules from the PSGallery during each build. You can improve build times and performance by instead loading the required modules into an S3 bucket. If you choose to do so, you can specify the S3 bucket here. Don't forget to give your CodeBuild project permission to that S3 bucket.
1. Create your CodeBuild project in your AWS account. You can do this manually, or use the generated CloudFormation template (recommended).
1. Create your CodeBuild project in your AWS account. While you can do this manually, using the CloudFormation (CFN) template generated by Catesta is recommended.
* **GitHub**
* The generated CFN template will guide you through the process. This CFN will be dynamically altered based on your buildspec choice specified during the plaster process. If you choose all three, the CFN will deploy all required resources to support all three build types.
* CodeBuild projects currently use OATH to authenticate with GitHub. **You need to configure OATH for CodeBuild *before* you deploy the CFN template**. See the notes section below for configuring this.
* The GitHub process is not currently configured to generate artifacts. You are welcome to make adjustments to include them.
* Upload the CFN template to AWS CloudFormation to deploy the required resources automatically. The template adapts to include support for any build types you've chosen during the Catesta setup, such as Windows, Linux, or macOS.
* CodeBuild projects currently use OATH to authenticate with GitHub. **You need to configure OATH for CodeBuild *before* you deploy the CFN template**. *Reference [Adding CodeBuild OATH to your Project Repository](#adding-codebuild-oath-to-your-project-repository) below for configuring this.*
* *Note: The GitHub process in the template does not automatically configure artifact generation. You may modify the template to include artifact generation if required.*
* *Don't forget to copy your badge URL to display on your project*
* **Bitbucket**
* The generated CFN template will guide you through the process. This CFN will be dynamically altered based on your buildspec choice specified during the plaster process. If you choose all three, the CFN will deploy all required resources to support all three build types.
* CodeBuild projects currently use OATH to authenticate with Bitbucket. **You need to configure OATH for CodeBuild *before* you deploy the CFN template**. See the notes section below for configuring this.
* The Bitbucket process is not currently configured to generate artifacts. You are welcome to make adjustments to include them.
* Upload the CFN template to AWS CloudFormation to deploy the required resources automatically. The template adapts to include support for any build types you've chosen during the Catesta setup, such as Windows, Linux, or macOS.
* CodeBuild projects currently use OATH to authenticate with Bitbucket. **You need to configure OATH for CodeBuild *before* you deploy the CFN template**. *Reference [Adding CodeBuild OATH to your Project Repository](#adding-codebuild-oath-to-your-project-repository) below for configuring this.*
* *Note: The Bitbucket process in the template does not automatically configure artifact generation. You may modify the template to include artifact generation if required.*
* *Don't forget to copy your badge URL to display on your project*
* **GitLab**
* Upload the CFN template to AWS CloudFormation to deploy the required resources automatically. The template adapts to include support for any build types you've chosen during the Catesta setup, such as Windows, Linux, or macOS.
* CodeBuild projects currently use CODECONNECTIONS to authenticate with GitLab. **You need to configure CODECONNECTIONS for CodeBuild *before* you deploy the CFN template**. *Reference [Adding CodeBuild CODECONNECTION to your Project Repository](#adding-codebuild-codeconnection-to-your-project-repository) below for configuring this.*
* *Note: The GitLab process in the template does not automatically configure artifact generation. You may modify the template to include artifact generation if required.*
* *Don't forget to copy your badge URL to display on your project*
* **CodeCommit**
* The CodeCommit does include artifacts. Artifacts built from your main branch will be stored in a primary s3 bucket. All other branches will have artifacts stored in a development bucket.
* The generated CFN template will guide you through the process. This CFN is different than the GitHub one in that you only need to deploy it once. This CFN will be dynamically altered based on your buildspec choice specified during the plaster process. If you choose all three, the CFN will deploy all required resources to support all three build types.
* * Upload the CFN template to AWS CloudFormation to deploy the required resources automatically. The template adapts to include support for any build types you've chosen during the Catesta setup, such as Windows, Linux, or macOS.
* *Note: The CodeCommit does include artifacts. Artifacts built from your main branch will be stored in a primary s3 bucket. All other branches will have artifacts stored in a development bucket.*
1. Write the logic for your module (the hardest part)
* All build testing can be done locally by navigating to `src` and running `Invoke-Build`
* By default, this runs all tasks in the build file.
Expand Down Expand Up @@ -64,6 +69,10 @@ Catesta automatically configures your AWS CodeBuild PowerShell project to genera

#### Adding CodeBuild OATH to your Project Repository

*Note: for GitHub and Bitbucket - [source doc]()*

AWS documentation for [ProjectSource](https://docs.aws.amazon.com/codebuild/latest/APIReference/API_ProjectSource.html) states that OAUTH should be set for GitHub and Bitbucket.

In order to accomplish [source provider access](https://docs.aws.amazon.com/codebuild/latest/userguide/access-tokens.html#access-tokens-github) to your project's repo using OATH, you will first need to configure CodeBuild in the AWS Console.

This needs to be done **prior to deploying your CFN template**.
Expand All @@ -72,6 +81,22 @@ Essentially, you just need to login to your AWS console, create a new CodeBuild

![Catesta AWS CodeBuild OATH Link Create](../assets/AWS/AWSCodeBuild_OAuth.png)

#### Adding CodeBuild CODECONNECTION to your Project Repository

AWS documentation for [ProjectSource](https://docs.aws.amazon.com/codebuild/latest/APIReference/API_ProjectSource.html) states that CODECONNECTIONS should be set for GitLab.

In order to accomplish [GitLab connections](https://docs.aws.amazon.com/codebuild/latest/userguide/connections-gitlab.html) to your project's repo using CODECONNECTIONS, you will first need to configure CodeBuild in the AWS Console.

This needs to be done **prior to deploying your CFN template**.

Essentially, you just need to login to your AWS console, create a new CodeBuild project, and under source, add a new connection. You will be prompted to enter your credentials to establish a link. Once complete, CodeBuild will have a new connection under the Connections tab. You do not actually need to create the project in the console. Once you've created the CODECONNECTIONS link, you can click Cancel on the new CodeBuild project creation page.

![Catesta AWS CodeBuild CODECONNECTION Link Create](../assets/AWS/AWSCodeBuild_GitLab_Connection.png)

Once created, you will need to capture the CodeStar CodeConnection Arn under the connections tab. **This ARN is a required parameter input for your CFN template**

![Catesta AWS CodeBuild CODECONNECTION Link Create](../assets/AWS/AWSCodeBuild_GitLab_ConnectionArn.png)

#### Manual CFN upload example

The following shows the GitHub CFN example:
Expand Down Expand Up @@ -102,6 +127,10 @@ You may wish to use different CodeBuild projects to monitor different branches o

![Catesta PowerShell AWS CodeBuild GitHub Diagram](../assets/AWS/AWSCodeBuildGitHub.png)

### AWS CodeBuild Integration with GitLab

![Catesta PowerShell AWS CodeBuild GitLab Diagram](../assets/AWS/AWSCodeBuildGitLab.png)

### AWS CodeBuild Integration with Bitbucket

![Catesta PowerShell AWS CodeBuild Bitbucket Diagram](../assets/AWS/AWSCodeBuildBitbucket.png)
Expand Down
2 changes: 1 addition & 1 deletion src/Catesta/Catesta.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Catesta.psm1'

# Version number of this module.
ModuleVersion = '2.8.0'
ModuleVersion = '2.9.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
Loading

0 comments on commit a9db354

Please sign in to comment.