Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from awslabs/feature/initial
Browse files Browse the repository at this point in the history
Feature/initial
srijitm authored Jun 8, 2020
2 parents 82a50b4 + 7b4841b commit 5b023ab
Showing 34 changed files with 6,007 additions and 41 deletions.
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

node_modules
.idea
*~
.build
.pt
*.swp
.DS_Store
.nyc_output/
*.csv
*.tgz
# Logs
logs
*.log
npm-debug.log
.tmp

# Runtime data
pids
*.pid
*.seed
dist

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

**/.idea
.serverless/
*.sw?
vim-markdown-preview.html
.vscode/
# Temporary output generate during build
build-artifacts/

# Temporary Git repo for checking changes
_GIT_REPO/
.vscode/

*.gitignored

# Compiled class file
*.class

# Maven
**/target/
**/.settings/

# CDK
**/cdk.out/
*.js
*.d.ts

# Transpiled typescript files
build/

7 changes: 4 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
# Code of Conduct

This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.
24 changes: 11 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.


## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
When filing an issue, please check [existing open](https://github.com/awslabs/aws-simple-cicd/issues), or [recently closed](https://github.com/awslabs/aws-simple-cicd/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

* A reproducible test case or series of steps
* The version of our code being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment


## Contributing via Pull Requests

Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the *master* branch.
@@ -36,26 +35,25 @@ To send us a pull request, please:
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).


## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.

Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/aws-simple-cicd/labels/help%20wanted) issues is a great place to start.

## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.

This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.

## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.

If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.

## Licensing

See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
See the [LICENSE](https://github.com/awslabs/aws-simple-cicd/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
32 changes: 14 additions & 18 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
MIT License
MIT No Attribution

Copyright (c) 2020 Amazon.com
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
## My Project
# AWS-Simple-CICD Project

TODO: Fill this README out!
This project aims to provide a production-grade, serverless CI/CD platform built using native AWS services provisioned using AWS Cloud Development Kit (CDK). As per the AWS Well Architected Framework, this project assumes the use of multiple AWS accounts for secure isolation of environments.

Be sure to:
This CI/CD platform is in use at a variety of AWS clients where the development teams are leveraging CloudFormation, Serverless Framework, AWS CDK and Terraform.

* Change the title in this README
* Edit your repository description on GitHub
## Goals

## License
- Bring Developers closer to their infrastructure and operations by providing a prescriptive platform.
- Support for (almost) any toolset the application developers want to use e.g. Terraform, CDK, Cloudformation, Pulumi etc.
- Minimize platform lock-in. Applications can be migrated to other CI/CD orchestration platform with minimal changes required by the developers.
- Enables "you build it, you run it".

This project is licensed under the Apache-2.0 License.
## Features

- Cloud native and built on top of [AWS Serverless CI/CD tools](https://aws.amazon.com/serverless/developer-tools/)
- Plug & Play on top of [AWS Landing Zone](https://aws.amazon.com/solutions/implementations/aws-landing-zone/)/[Control Tower](https://aws.amazon.com/controltower/)
- Supports pipeline notifications via [AWS SNS](https://aws.amazon.com/sns/)
- Supports branches (pipeline per branch)
- Auto-increments [semantic versioning](https://www.semver.org) per pipeline.

## Architecture

This is the pipeline that will be generated for each repository. The build and deployment stages in the pipeline execute a user defined shell script in an isolated docker container. The docker environment is provisioned on the fly by AWS CodeBuild.

The number of stages and their function is fully customizable e.g. adding a stage for security/vulnerability scanning, adding a stage for executing test cases etc.

![Architecture](./architecture.png "CI/CD Architecture")

### AWS services

- AWS CodeCommit (or any source control providor supported by CodePipeline)
- AWS CodePipeline
- AWS CodeBuild
- AWS Lambda
- AWS S3
- AWS SNS
- AWS CloudWatch
- AWS Systems Manager: Parameter Store
- AWS CloudFormation

## Getting started

- [Pre-Requisites](docs/prereq.md)
- [Administrator Guide](docs/admin.md)
- [Developer Guide](docs/developer.md)
32 changes: 32 additions & 0 deletions THIRD_PARTY_NOTICES
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
** python-semver; version 2.9.1 --
https://github.com/python-semver/python-semver
Copyright (c) 2013, Konstantine Rybnikov
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice,
this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

Neither the name of the {organization} nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions architecture.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="drawio.corp.amazon.com" modified="2020-06-04T22:42:30.421Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" etag="SqxcFsqvOM3Tzoij2Pwu" version="12.4.8" type="device"><diagram id="6hGFLwfOUW9BJ-s0fimq" name="Page-1">7VvZbuM2FP0aA+1DA62W/eglyRRIgQAuMJOngJZoma0kqhTlpV/fS4m0FsrNBF6UzDgTILqXFJfDc0heUjOwZ/HukaF0/QcNcDSwjGA3sOcDyzLH1hD+CM++9Ixto3SEjAQyU+VYkH+xdKpsOQlw1sjIKY04SZtOnyYJ9nnDhxij22a2FY2ataYoxJpj4aNI934lAV+X3pFrVP4vmIRrVbNpyJQYqczSka1RQLc1l30/sGeMUl4+xbsZjgR4CpfyvYcjqYeGMZzw73nBKl/YoCiXfZt8XYBjFtE8kE3ke9XvlJKEF9i5U/iFomfGwIWUmbDuLLflaNte02Hqliij6WjbXtNhtos3W/Wb7QbWHJrVKN5o1W/UGgi/9pTmPCIJnh1YZoAzZCgggP6MRpSBL6EJoDdd8zgCy4TH7ZpwvEiRL1DdgkLAt6IJlzw3LWVL4EWpwJNUPMe7UEjqDm0z5y5kNE+LKn8HpnemvsLjqy8G8xVFXBTEGf0bq8YNLBv+PQhuTFckilqN3mDGCdB+EpFQlM+pqA5JK8KrokToCUnCp8Ka24Zs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WH3dk3Y8R2PimtFtNYYruE/OVUJv2UF4BPIME53VZoKhSdpyigUqgfJygMtK2tQ7rY01jRe5tl1ZDG2m7Iwxnf65yBuhzDc948BmNUX9kVa7f8p2Pf/AQ==</diagram></mxfile>
Binary file added architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions bin/cicd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: MIT-0
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


import 'source-map-support/register'
import cdk = require('@aws-cdk/core')
import { CicdStack } from '../lib/cicd-stack'
import { S3Stack } from '../lib/cicd-s3-stack'
import { EmailHandlerStack } from '../lib/emailHandler-stack'
import { SemverHandlerStack } from '../lib/semverHandler-stack'
import {default as config } from '../config/config'

// Setup prefix
let prefix = `${config.naming.company}-${config.naming.dept}-${config.naming.project}`
let ssmRoot = `/${config.naming.company}/${config.naming.dept}/${config.naming.project}`


const app = new cdk.App()

new S3Stack(app, 'AWS-Simple-CICD-S3', { prefix, ssmRoot })
new EmailHandlerStack(app, 'AWS-Simple-CICD-EmailHandler', { prefix, ssmRoot })
new SemverHandlerStack(app, 'AWS-Simple-CICD-SemverHandler', { prefix, ssmRoot })
new CicdStack(app, 'AWS-Simple-CICD-TeamOne', { prefix, ssmRoot, repos: config.teamOne})
//new CicdStack(app, 'TeamTWo-CICD', { prefix, ssmRoot, repos: config.teamTwo})
3 changes: 3 additions & 0 deletions cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app": "node build/bin/cicd.js"
}
72 changes: 72 additions & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: MIT-0
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


import configFile from "../project-config.json"

export enum TriggerType {
CodeCommit = "CodeCommit"
}

export enum Regions {
CanadaCentral="CA-CENTRAL-1"
}

export enum StageName {
dev = 'dev',
test = 'test',
prod = 'prod'
}

export type ProjectRepo = {
pipelineName: string,
ccRepoName: string,
branch: string,
type: TriggerType,
cron: string
}

export interface ProjectConfig {
naming: {
company: string,
dept: string,
project: string
},
deployment: {
region: string
},
accountIds: {
dev: string,
test: string,
prod: string
},
sharedResources: {
cicdBucket: string
},
defaultRegions: {
cicd: string,
dev: string,
test: string,
prod: string
},
teamOne: Array<ProjectRepo>
}

const config = <ProjectConfig>configFile

export default config
Loading

0 comments on commit 5b023ab

Please sign in to comment.