File tree Expand file tree Collapse file tree 3 files changed +31
-17
lines changed Expand file tree Collapse file tree 3 files changed +31
-17
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ if [ -n " $CODEBUILD_BUILD_ID " ]; then
6
+ # CodeBuild environment
7
+ IMAGE_TAG=${CODEBUILD_RESOLVED_SOURCE_VERSION: 0: 7}
8
+ else
9
+ # Local Git repository
10
+ IMAGE_TAG=$( git rev-parse --short HEAD)
11
+ fi
12
+
13
+ IMAGE_NAME=aiproxy
14
+
15
+ echo " Building Docker Image ${IMAGE_NAME} :${IMAGE_TAG} ..."
16
+ docker build -t ${IMAGE_NAME} :${IMAGE_TAG} .
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ echo " Validating Cloudformation Templates via cfn-lint docker..."
6
+ docker run --rm -i
7
+ cfn-lint cicd/1-setup/* .template.yml
8
+ cfn-lint cicd/2-cicd/* .template.yml
9
+ cfn-lint cicd/3-app/aiproxy/template.yml
10
+
11
+ echo " Validating Dockerfile..."
12
+ docker run --rm -i hadolint/hadolint < Dockerfile
Original file line number Diff line number Diff line change @@ -17,29 +17,15 @@ phases:
17
17
- echo Logging in to Docker Hub...
18
18
- echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USERNAME --password-stdin
19
19
20
-
21
20
build :
22
- # This should be moved to a shell script if it gets more complicated.
23
21
commands :
24
22
- set -e
25
23
26
24
- BRANCH_NAME=${CODEBUILD_WEBHOOK_HEAD_REF#"refs/heads/"}
27
25
- ARTIFACT_PATH=branch/$BRANCH_NAME/$CODEBUILD_BUILD_NUMBER
26
+ - COMMIT_HASH=${CODEBUILD_RESOLVED_SOURCE_VERSION:0:7}
28
27
29
28
- cd $CODEBUILD_SRC_DIR
30
29
31
- - echo "Validating Cloudformation Templates..."
32
- - cfn-lint cicd/1-setup/*.template.yml
33
- - cfn-lint cicd/2-cicd/*.template.yml
34
- - cfn-lint cicd/3-app/aiproxy/template.yml
35
-
36
- - echo "Building Docker Image..."
37
- - IMAGE_NAME=aiproxy
38
- - IMAGE_TAG=${CODEBUILD_RESOLVED_SOURCE_VERSION:0:7}
39
- - docker build -t ${IMAGE_NAME}:${IMAGE_TAG} .
40
-
41
- - echo "Running Unit Tests..."
42
- - docker run --rm ${IMAGE_NAME}:${IMAGE_TAG} python -m unittest test_app.py
43
-
44
- - echo "Pushing Docker Image to ECR..."
45
- - echo "This is where I would push the docker image to ECR, when I get around to it"
30
+ - ./ci-lint.sh
31
+ - ./ci-build.sh
You can’t perform that action at this time.
0 commit comments