sourcetoad / aws-codedeploy-action

AWS CodeDeploy via GitHub Actions
MIT License
35 stars 14 forks source link

Step fails without any error shown #29

Closed loweehahn closed 3 years ago

loweehahn commented 3 years ago

I'm trying to build and deploy my Java app to an EC2 instance using CodeDeploy. There are 7 steps in my yml file. The last step is where I run sourcetoad/aws-codedeploy-action@v1.0.1. GitHub Actions doesn't state the reason why the step fails.

Here's my yml file:

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: CI with Maven

on:
# Triggers the workflow on push request event but only for the master branch
  push:
    branches: [ master ]

jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job

    steps:
    # Checkout the master branch
    - name: Step 1 - Checkout master branch from GitHub
      uses: actions/checkout@v2

    # Ensure the JDK is been setup
    - name: Step 2 - Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8

    # Build the project with Maven
    - name: Step 3 - Have GitHub Actions build the project with Maven
      run: mvn -B package --file pom.xml

    # Copy the jar to a folder called staging
    - name: Step 4 -Copy the jar file
      run: mkdir staging && cp target/*.jar staging

    # Cache all the dependencies to speed up the workflow runs
    - name: Step 5 - Set up a cache for Maven
      uses: actions/cache@v2
      with:
        path: ~/.m2
        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
        restore-keys: ${{ runner.os }}-m2

    # Package the artificate and allow us to download them. This is useful for re-testing in local environment
    - name: Step 6 - Persist workflow data as astifacts
      uses: actions/upload-artifact@v2
      with:
        name: github-actions-artifact
        path: staging

    - name: Step 7 - Sourcetoad - AWS CodeDeploy for GitHub Actions
      uses: sourcetoad/aws-codedeploy-action@v1.0.1
      with:
        # AWS Access Key
        aws_access_key: ***
        # AWS Secret Key
        aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
        # AWS Region
        aws_region: ap-southeast-1
        # S3 Bucket for CodeDeploy Assets
        s3_bucket: ***
        # S3 Folder for ZIP.
        s3_folder: /
        # AWS CodeDeploy Application Name
        codedeploy_name: ***
        # AWS CodeDeploy Application Group
        codedeploy_group: ***

And the output:

Screenshot 2021-03-18 at 3 54 14 PM

iBotPeaches commented 3 years ago

I would try a few things. The latest release (v1.0.3) has some fixes as well as increased logging in debug mode. The only thing I'm aware of right now that requires more error handling is the uploading of zip/binary to S3. If that has no permission it fails quite ugly with out no output right now.

I would update to v1.0.3 first, then you can attach secrets to your repo with

loweehahn commented 3 years ago

I found out that I've actually made a typo error when pasting the secret key. How silly of me!

With that, the issue is now resolved.