aws-samples / aws-samples/aws-codedeploy-samples

[Github Action] AWS CodeDeploy Succeeded but in EC2 created modified file

オープン
#96 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Shell
スター
639
フォーク
778
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi everyone, i'm setting up the Github Action, AWS EC2, CodeDeploy. All the configuration seems working well. But excepts one thing. I can not understand and how can i solve it. If someone have experiences about this please help me.

I'm using:
- EC2 Rhel 8
- Node project (VueJs framework)

This is my cicd.yml file
```
on:
push:
branches:
- paymentV2

name: Deploy VueJS to Amazon ECS
#on: [push]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['12.x']
appname: ['staging-aws-codedeploy']
deploy-group: ['staging']
repo: ['project/MyProject']

steps:
- uses: actions/checkout@v2

# Configure AWS credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-1

# Deploy to AWS
- name: Deploy to AWS
run: |
aws deploy create-deployment \
--application-name ${{ matrix.appname }} \
--deployment-config-name CodeDeployDefault.OneAtATime \
--deployment-group-name ${{ matrix.deploy-group }} \
--file-exists-behavior OVERWRITE \
--description "GitHub Deployment for the ${{ matrix.appname }}-${{ github.sha }}" \
--github-location repository=${{ matrix.repo }},commitId=${{ github.sha }}
```
This is my appspec.yml
```
version: 0.0
os: linux
files:
- source: /
destination: /var/www/MyProject
hooks:
ApplicationStart:
- location: scripts/application_start.sh
timeout: 300
runas: root
#scripts/application_start.sh
#cd /var/www/MyProject
#npm run build
```
This is the log from Github action & CodeDeploy AWS
![image](https://user-images.githubusercontent.com/48058748/115502116-9992cf80-a29e-11eb-8e14-4121d4621bc3.png)

I've tried editing the **Vision.vue** file and created the pull request on Github. Everything was working well. But one thing i'm confusing is why the modified file is existed. Please refer the image below

![Group 3](https://user-images.githubusercontent.com/48058748/115501326-38b6c780-a29d-11eb-8898-1c387f6889ba.png)

=> What am i expected is the modified file shouldn't have existed. I thought that Github should be automatically run **git pull** to get all new source code.
I've some more researched and found --file-exists-behavior with OVERWRITE but it seems not working as i want.
https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment.html

==> Once again, i have no experience about CD by Github action & CodeDeploy. Everyone please help me and advice me the right thing. Thank you so much.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。