Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to aws broken after 2023-02-04 #7049

Closed
2 of 10 tasks
benbai123 opened this issue Feb 6, 2023 · 14 comments
Closed
2 of 10 tasks

Deploy to aws broken after 2023-02-04 #7049

benbai123 opened this issue Feb 6, 2023 · 14 comments

Comments

@benbai123
Copy link

Description

I use github action to deploy my project to aws elasticbeanstalk, it works well till 2023-02-04 and broken today.

There are 2 messages in failed action

warning: Not a git repository. Use --no-index to compare two paths outside a working tree
usage: git diff --no-index [<options>] <path> <path>

And

ERROR: CommandError - An error occurred while handling git command.
Error code: 128 Error: fatal: detected dubious ownership in repository at '/github/workspace'
To add an exception for this directory, call:

	git config --global --add safe.directory /github/workspace

I have checked the versions of ubuntu, actions/checkout@v2 git are

  • Current runner version: '2.301.1'

  • ubuntu 22.04.1

    • Image: ubuntu-22.04
    • Version: 20230129.2
  • git version 2.39.1

And they are not changed from previous success action.

What I have tried:

  • Create a new branch from previous success commit and run the Action, failed.
  • Add git config --global --add safe.directory /github/workspace before or after actions/checkout, failed.

My yml as below

name: CD

on:
  push:
    branches:
      - develop
      - '**force_deploy**'

env:
  AWS_ENVIRONMENT_NAME: MY_ENVIRONMENT
  AWS_DEFAULT_REGION: MY_REGION

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        id: node_modules-cache
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node_modules-
      - name: Install Dependencies
        if: steps.node_modules-cache.outputs.cache-hit != 'true'
        run: npm install --prefer-offline
      # TODO: Enable junit xml report later with `yarn lint -f junit -o reports/junit/eslint/results.xml`
      # Because GitHub Workflow doesn't support junit reports yet.
      - name: Run ESLint
        run: npm run lint

  deploy-dev:
    needs: [lint]
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '14.x'
          registry-url: 'https://registry.npmjs.org'

      - name: Install
        run: |
          node -v
          yarn -v
          npm install

      - name: Deploy
        uses: hmanzur/actions-aws-eb@v1.0.0
        with:
          command: 'deploy MY_ENVIRONMENT'
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}

What I did before it broken is just change several lines of a js file.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Runner Image
Image: ubuntu-22.04
Version: 20230129.2
Included Software: https://github.com/actions/runner-images/blob/ubuntu22/2023012[9](https://github.com/Looplus/looplus-api-nest/actions/runs/4103340879/jobs/7077414052#step:1:10).2/images/linux/Ubuntu2204-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230129.2

Is it regression?

first failed build: https://github.com/Looplus/looplus-api-nest/actions/runs/4099975042, previous successful build: https://github.com/Looplus/looplus-api-nest/actions/runs/4090737669

Expected behavior

build success and deployed to my aws elasticbeanstalk

Actual behavior

Failed with message not a git repository and error 128

Repro steps

  1. create a branch with name ends with _force_deploy to trigger the action.
@ddobranic
Copy link
Contributor

Thank you, @benbai123 ! We will take a look.

@ddobranic ddobranic self-assigned this Feb 6, 2023
@ddobranic
Copy link
Contributor

@benbai123 could you please upload logs from the successful and failed builds since I don't have access to the links in repository you provided?

@benbai123
Copy link
Author

@ddobranic sure, success and faild logs :

success_log.zip

failed_log.zip

@ddobranic
Copy link
Contributor

@benbai123 I can see the error in "deploy looplus-api-dev-with-nest" command in 1_deploy_dev.txt file for unsuccessful build

@benbai123
Copy link
Author

benbai123 commented Feb 6, 2023

@benbai123 I can see the error in "deploy looplus-api-dev-with-nest" command in 1_deploy_dev.txt file for unsuccessful build

Yes, the command start failed today, it works well till 2023-02-04, the yml file is not changed before the failed build, you can find same command in same file for successful build.

I have tried diff them online with diffchecker, they almost the same.

@m3rolam
Copy link

m3rolam commented Feb 6, 2023

@benbai123
We ran into the same issue today on our projects. Was able to workaround the issue using the following suggestions:
#6775 (comment)
#6775 (comment)

@benbai123
Copy link
Author

@m3rolam

Thanks, I tried it but still not working.
I guess because I use hmanzur/actions-aws-eb and it create a docker container so I should run that git command inside that container?

@benbai123
Copy link
Author

One more information:

I did not restart and update by Github Desktop several months, it crashed today (2023-02-07) and I reinstall it.

My Mac said Github desktop "will damage your computer. You should move this app to the Trash"

Not sure whether they are related.

@ddobranic
Copy link
Contributor

It is not related. You should download new official version and reinstall.

@ddobranic
Copy link
Contributor

@m3rolam thank you for providing workaround.
@benbai123 since you are running from docker container, please try solution.
I will close the issue, but if you have any other questions or concerns please fell free to reopen.

@benbai123
Copy link
Author

benbai123 commented Feb 8, 2023

@ddobranic the solution need a self hosted Dockerfile but that is not my case.

I've tried to deploy by upload a zip file to aws eb and it works, probably the total size of files caused this issue (since the npm install in my yml).

I will use zip upload deploy in the mean time and try to figure it out.

UPDATE: Problem still exists after remove the npm install command.

@benbai123
Copy link
Author

benbai123 commented Feb 8, 2023

Finally solved it by the steps below:

  • Remove npm install in my yml file.

  • Change deploy tool to Beanstalk Deploy

    • I changed the zip command to zip deploy.zip -r * .[^.]* as aws docs suggested.

@bsonmez
Copy link

bsonmez commented Mar 2, 2023

@m3rolam

Thanks, I tried it but still not working. I guess because I use hmanzur/actions-aws-eb and it create a docker container so I should run that git command inside that container?

Same issue with the same package

pavelsimjanoski pushed a commit to thebigsearch/actions-aws-eb that referenced this issue May 8, 2023
pavelsimjanoski pushed a commit to thebigsearch/actions-aws-eb that referenced this issue May 8, 2023
pavelsimjanoski pushed a commit to thebigsearch/actions-aws-eb that referenced this issue May 8, 2023
pavelsimjanoski pushed a commit to thebigsearch/actions-aws-eb that referenced this issue May 8, 2023
@pavelsimjanoski
Copy link

@bsonmez you can use my fork it has the fix you are looking for. Here: https://github.com/thebigsearch/actions-aws-eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants