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

Add examples for using Serverless Plugins #28

Closed
matthewpoer opened this issue Apr 29, 2020 · 4 comments
Closed

Add examples for using Serverless Plugins #28

matthewpoer opened this issue Apr 29, 2020 · 4 comments

Comments

@matthewpoer
Copy link

Sharing an example of using this Action with one or more SLS Serverless plugins. Would be nice to add some notes around this to the README.md. The key is to set both args and entrypoint on the step.

Similar tactic is used in #26 to capture resources.Outputs data.

name: Deploy
on:
  push:
    branches:
      - master
jobs:
  deploy:
    name: Deployment
    runs-on: ubuntu-latest
    strategy:
      matrix:
        stages:
          - stage: 'dev'
            AWS_SECRET_ACCESS_KEY: 'AWS_SECRET_ACCESS_KEY_DEV'
            AWS_ACCESS_KEY_ID: 'AWS_ACCESS_KEY_ID_DEV'
          - stage: 'prod'
            AWS_SECRET_ACCESS_KEY: 'AWS_SECRET_ACCESS_KEY_PROD'
            AWS_ACCESS_KEY_ID: 'AWS_ACCESS_KEY_ID_PROD'
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Install VPC Plugin and Deploy
      uses: serverless/github-action@v1.53.0
      with:
        args: -c "serverless plugin install --name serverless-vpc-discovery && serverless deploy --stage=${{ matrix.stages.stage }} --verbose"
        entrypoint: /bin/bash
      env:
        AWS_ACCESS_KEY_ID: ${{ secrets[matrix.stages.AWS_ACCESS_KEY_ID] }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets[matrix.stages.AWS_SECRET_ACCESS_KEY] }}
        SLS_DEBUG: 1
@benjefferies
Copy link

I was just about to start figuring this out but you've saved me some time. Thanks for the issue/documentation @matthewpoer

@matthewpoer
Copy link
Author

Update for all those who find this the hard way: serverless plugin install ... will find and install the latest version of a plugin. You can tag specific versions, but I found this easier:

    - name: Install SLS Plugins and Deploy
      uses: serverless/github-action@v1.53.0
      with:
        args: -c "npm install --also=dev && npm list -g && npm list && serverless deploy --stage=${{ matrix.stages.stage }} --verbose"
        entrypoint: /bin/bash

The extra npm list bits are nice to check versions :D

@porthunt
Copy link

For anyone getting this error:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown.
time="2021-08-24T14:37:43Z" level=error msg="error waiting for container: context canceled"

Change the entrypoint to /bin/sh. It affects >2.18.0 (therefore master too).

More info on #52

@Ddevon
Copy link

Ddevon commented Aug 23, 2022

does this not relevant if the plugins were installed with npm?

ryanlawson pushed a commit to ryanlawson/serverless-github-action that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants