-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copied old lambda files into repository template
- Loading branch information
1 parent
7f5a341
commit 728c62c
Showing
22 changed files
with
976 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = tabs | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
indent_size = 2 | ||
indent_style = spaces | ||
|
||
[*.py] | ||
indent_style = space | ||
|
||
[*.{yaml,yml}] | ||
indent_size = 2 | ||
indent_style = tabs | ||
|
||
[COMMIT_EDITMSG] | ||
max_line_length = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 8, | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"prettier" | ||
], | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"eqeqeq": [ | ||
"error", | ||
"always" | ||
], | ||
"no-console": "off", | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"printWidth": 120, | ||
"bracketSpacing": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"useTabs": true | ||
} | ||
], | ||
"sort-imports": ["error", { | ||
"ignoreCase": false, | ||
"ignoreDeclarationSort": false, | ||
"ignoreMemberSort": false, | ||
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"] | ||
}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Lines starting with '#' are comments. | ||
# Each line is a file pattern followed by one or more owners. | ||
# The last matching pattern has the most precendence. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence. | ||
|
||
* @xavier-thomas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
name: 🐛 Bug report | ||
about: Create a report to help us improve | ||
--- | ||
<!--- Verify first that your issue is not already reported on GitHub --> | ||
<!--- Also test if the latest release and devel branch are affected too --> | ||
<!--- Complete *all* sections as described, this form is processed automatically --> | ||
|
||
##### SUMMARY | ||
<!--- Explain the problem briefly below --> | ||
|
||
##### ISSUE TYPE | ||
- Bug Report | ||
|
||
##### VERSIONS | ||
<!--- Check which version of the Serverless Application you have deployed --> | ||
<!--- Check which version of NodeJS you are running the lambda on --> | ||
```paste below | ||
``` | ||
|
||
##### CONFIGURATION | ||
<!--- Which parameters are you running the Serverless Applicaiton with --> | ||
```paste below | ||
``` | ||
|
||
##### STEPS TO REPRODUCE | ||
<!--- Describe exactly how to reproduce the problem, using a minimal test-case --> | ||
|
||
<!--- Paste examples or commands between quotes below --> | ||
```yaml | ||
|
||
``` | ||
|
||
<!--- HINT: You can paste gist.github.com links for larger files --> | ||
|
||
##### EXPECTED RESULTS | ||
<!--- Describe what you expected to happen when running the steps above --> | ||
|
||
|
||
##### ACTUAL RESULTS | ||
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) --> | ||
|
||
<!--- Paste verbatim command output between quotes --> | ||
```paste below | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: ✨ Feature request | ||
about: Suggest an idea for this project | ||
--- | ||
<!--- Verify first that your feature was not already discussed on GitHub --> | ||
<!--- Complete *all* sections as described, this form is processed automatically --> | ||
|
||
##### SUMMARY | ||
<!--- Describe the new feature/improvement briefly below --> | ||
|
||
##### ISSUE TYPE | ||
- Feature Idea | ||
|
||
##### ADDITIONAL INFORMATION | ||
<!--- Describe how the feature would be used, why it is needed and what it would solve --> | ||
|
||
<!--- Paste example or commands between quotes below --> | ||
```yaml | ||
|
||
``` | ||
|
||
<!--- HINT: You can also paste gist.github.com links for larger files --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Description | ||
|
||
Please include a summary of the change and which issue is fixed. | ||
Please also include relevant motivation and context. | ||
List any dependencies that are required for this change. | ||
|
||
|
||
## Type of change | ||
- [ ] :bug: Bug fix (non-breaking change which fixes an issue) | ||
- [ ] :rocket: New feature (non-breaking change which adds functionality) | ||
- [ ] :boom: Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] :closed_lock_with_key: Security fix | ||
- [ ] :notebook: Documentation update | ||
- [ ] :whale2: Other (if none of the other choices apply) | ||
|
||
# How Has This Been Tested? | ||
|
||
Please describe the tests that you ran to verify your changes. | ||
Provide instructions so we can reproduce. | ||
Please also list any relevant details for your test configuration | ||
|
||
# Checklist: | ||
|
||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have commented on my code, particularly in hard-to-understand areas | ||
- [ ] I have added necessary documentation (if appropriate) | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] Any dependent changes have been merged and published in downstream modules | ||
- [ ] Changelog has been updated | ||
- [ ] Linting and testing (unit and component) passing locally | ||
- [ ] Check that sonarqube has no errors | ||
- [ ] Integration tests passing and extra tests added if necessary | ||
- [ ] Errors and handled and Logged | ||
- [ ] Types added to all method signatures and parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Changelog | ||
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/). | ||
|
||
|
||
# <<<----- ADD NEW VERSIONS HERE | ||
|
||
|
||
|
||
|
||
|
||
## 🚀 1.0.0 - (Aug 15, 2018) | ||
### Initial | ||
- Pipeline Monitor lambda released under closed source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<h1 align="center">Pipeline->Pipeline Monitoring λ</h1> | ||
|
||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xavier-thomas_aws-pipeline-monitor-lambda&metric=alert_status)](https://sonarcloud.io/dashboard?id=xavier-thomas_aws-pipeline-monitor-lambda) | ||
[![Dependency Status](https://david-dm.org/xavier-thomas/aws-pipeline-monitor-lambda.svg)](https://david-dm.org/xavier-thomas/aws-pipeline-monitor-lambda) | ||
|
||
|
||
<h4 align="center">An AWS lambda for a deployment pipeline to monitor a target pipeline in another account.</h4> | ||
|
||
<p align="center"> | ||
<a href="#overview">Overview</a> | | ||
<a href="#getting-started">Getting Started</a> | | ||
<a href="#invoking-the-lambda">Invoking the Lambda</a> | | ||
<a href="#authors">Authors</a> | | ||
<a href="#licence">Licence</a> | ||
</p> | ||
|
||
## Overview | ||
### How it works | ||
The incoming **UserParameters** object on the AWS CodePipeline invocation event will have the target pipeline name and the ARN of a role with permissions to monitor it. | ||
Invoking the lambda from a pipeline will: | ||
* Assume the cross account role | ||
* Generate secure temporary credentials using that role. | ||
* Find the status of the target pipeline | ||
* Send a continuation token to the invoking pipeline if the target pipeline is still in progress. Which will cause the invoking pipeline to poll the lambda periodically until the target pipeline succeeds. | ||
* Send a failure / success signal to the invoking pipeline if the target pipeline has failed or succeeded. | ||
|
||
## Getting started | ||
### Prerequisites | ||
To clone and run this application, you'll need Git, Node.js and npm installed. You can also use an alternative package manager, such as Yarn if you prefer! | ||
|
||
### Installing | ||
From your favourite command line tool, run the following: | ||
```bash | ||
# Clone the repo | ||
git clone https://github.com/MetOffice/pipeline-monitor-lambda.git | ||
|
||
# Install dependencies | ||
npm ci | ||
``` | ||
|
||
### Running tests | ||
From your favourite command line tool, run the following: | ||
```bash | ||
# Run the unit tests | ||
npm test | ||
``` | ||
|
||
### Linting & code formatting | ||
From your favourite command line tool, run the following: | ||
```bash | ||
# Run the linter | ||
$ npm run lint | ||
``` | ||
|
||
## Invoking the Lambda | ||
### Inputs | ||
The lambda expects the following UserParameters to be supplied during invocation: | ||
```JSON | ||
{ | ||
"targetname": "target-pipeline-name", | ||
"assumerolename": "arn:aws:iam::${AccountId}:role/PipelineMonitoringRole-${Tier}" | ||
} | ||
``` | ||
|
||
## Authors | ||
**[Xavier Thomas](https://github.com/xavier-thomas)** | ||
|
||
## Licence | ||
**[3-Clause BSD](./LICENCE)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
version: 0.2 | ||
|
||
phases: | ||
install: | ||
runtime-versions: | ||
nodejs: 12 | ||
commands: | ||
- echo Installation started on `date` | ||
- apt-get update -y | ||
- apt-get upgrade -y | ||
- apt-get install gettext libgettextpo-dev -y | ||
- npm install -g npm | ||
- npm ci | ||
- npm audit | ||
- echo Installation completed on `date` | ||
|
||
pre_build: | ||
commands: | ||
- echo Pre build started on `date` | ||
- echo Running tests | ||
- npm test | ||
- echo Running static analysis | ||
- npm run lint | ||
- npm prune --production | ||
- echo Pre build completed on `date` | ||
|
||
build: | ||
commands: | ||
- echo Build started on `date` | ||
- > | ||
aws cloudformation package --template-file pipeline-monitoring-lambda.yaml | ||
--output-template-file packaged-pipeline-monitoring-lambda.cf.yaml | ||
--s3-bucket ${PIPELINE_ARTIFACT_BUCKET} | ||
--kms-key-id "${KMS_KEY_ID}" | ||
- echo Build completed on `date` | ||
|
||
artifacts: | ||
files: | ||
- packaged-pipeline-monitoring-lambda.cf.yaml | ||
- tags.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"coverageDirectory": "../coverage", | ||
"collectCoverage": true, | ||
"rootDir": "./src", | ||
"testEnvironment": "node", | ||
"verbose": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[Licenses] | ||
authorized_licenses: | ||
bsd | ||
new bsd | ||
bsd license | ||
new bsd license | ||
simplified bsd | ||
apache | ||
apache 2.0 | ||
apache license 2.0 | ||
apache software | ||
apache software license | ||
mit | ||
mit license | ||
mpl-2.0 | ||
|
||
unauthorized_licenses: | ||
gpl v3 | ||
gnu lgpl | ||
lgpl with exceptions or zpl | ||
isc license | ||
isc license (iscl) | ||
python software foundation license | ||
zpl 2.1 | ||
|
||
[Authorized Packages] | ||
|
Oops, something went wrong.