File tree Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 0.2
2
+
3
+ phases :
4
+ build :
5
+ commands :
6
+ - ./ci_tools/update_shrinkwrap.sh
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const AWS = require ( 'aws-sdk' ) ;
4
+ const codebuild = new AWS . CodeBuild ( ) ;
5
+
6
+ const codebuildProject = process . env . projectName ;
7
+ const codebuildBuildspec = process . env . buildspec ;
8
+
9
+ exports . handler = ( event , context , callback ) => {
10
+ try {
11
+ var params = {
12
+ projectName : codebuildProject
13
+ } ;
14
+
15
+ if ( event . project ) {
16
+ params . projectName = event . project ;
17
+ } else if ( event . details && event . details . project ) {
18
+ params . projectName = event . details . project ;
19
+ }
20
+
21
+ if ( event . buildspec ) {
22
+ params . buildspecOverride = event . buildspec ;
23
+ } else if ( event . details && events . details . buildspec ) {
24
+ params . buildspecOverride = event . details . buildspec ;
25
+ } else if ( codebuildBuildspec ) {
26
+ params . buildspecOverride = codebuildBuildspec ;
27
+ }
28
+
29
+ if ( event . source &&
30
+ event . source == "aws.codecommit" &&
31
+ event . detail . commitId ) {
32
+ params . sourceVersion = event . detail . commitId ;
33
+ }
34
+
35
+ codebuild . startBuild ( params , ( error , data ) => {
36
+ if ( error ) {
37
+ console . log ( error , error . stack ) ;
38
+ return callback ( error ) ;
39
+ }
40
+
41
+ console . log ( data ) ;
42
+ return callback ( null , data ) ;
43
+ } ) ;
44
+ } catch ( error ) {
45
+ console . log ( 'Caught Error: ' , error ) ;
46
+ callback ( error ) ;
47
+ }
48
+ } ;
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -ev
4
+
5
+ # Set up git client
6
+ git config --global credential.helper ' !aws codecommit credential-helper $@'
7
+ git config --global credential.UseHttpPath true
8
+ git config --global user.name " Shrinkwrapper Bot"
9
+ git config --global user.email shrinkwrapper@example.com
10
+ git config --global push.default simple
11
+
12
+ if [ -e npm-shrinkwrap.json ]
13
+ then
14
+ rm npm-shrinkwrap.json
15
+ fi
16
+
17
+ npm install
18
+ npm test
19
+ npm shrinkwrap --dev
20
+
21
+ if [ -n " $( git status --porcelain) " ]; then
22
+ git add npm-shrinkwrap.json
23
+ git commit -m " Update npm dependencies"
24
+ git push origin HEAD:master
25
+ else
26
+ echo " No dependency updates!"
27
+ fi
You can’t perform that action at this time.
0 commit comments