-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec-dev.yml
35 lines (32 loc) · 1.18 KB
/
buildspec-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
version: 0.2
phases:
pre_build:
commands:
- mvn clean package -P develop
- aws --version
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- REPOSITORY_URI={number}.dkr.ecr.eu-west-1.amazonaws.com/java-sample-ecr
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- REPOSITORY_URI_CONFIG=" "$REPOSITORY_URI
build:
commands:
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- docker push $REPOSITORY_URI:$IMAGE_TAG
- printf '[{"name":"java-sample","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
- cat imagedefinitions.json
- git config --global user.email "vankientl99@gmail.com"
- git config --global user.name "kien-fit"
- git clone https://github.com/Kien-fit/helm-charts.git
- cd helm-charts/java-sample
- git checkout develop
- sed -i "s|tag:.*|tag:$IMAGE_TAG|g" values.yaml
- git add .
- git commit -m "change image tag"
- git push origin develop
artifacts:
files:
- imagedefinitions.json
- dist/java-sample.jar