Goodsmileduck / yandex-serverless-action

Github Action for deploying code to existed Serverless function in Yandex cloud
43 stars 6 forks source link

Feature request: Update env variables of cloud function #3

Closed sergeyzwezdin closed 4 years ago

sergeyzwezdin commented 4 years ago

It would be very useful if we could update env variables settings during deploy together with updating actual code.

sergeyzwezdin commented 4 years ago

@Goodsmileduck is there any chance to have it implemented? It clears env variables on every deployment it makes this action useless :(

Goodsmileduck commented 4 years ago

@sergeyzwezdin I can do that, how you would like to set them? 1 variable with comma-separated parameters?

Goodsmileduck commented 4 years ago

can you try to test branch dev ? just set variables separated with commas in var ENVIRONMENT don't forget to change branch in workflow file - uses: goodsmileduck/yandex-serverless-action@dev https://github.com/Goodsmileduck/yandex-serverless-action/pull/4

sergeyzwezdin commented 4 years ago

@Goodsmileduck It works for simple values like TEST=123, but how to put something more complicated? For example, TEST=User Name <info@domain.com>.

sergeyzwezdin commented 4 years ago

@Goodsmileduck Also, maybe it would be better to use GH Action with section?

    - uses: goodsmileduck/yandex-serverless-action@master
      with:
         environment:
            - TEST1: User Name <info@domain.com>.
            - TEST2: 123
      env:
        SOURCE_DIR: '.'
        ZONE: 'ru-central1-a'
        FUNCTION_NAME: 'handler'
        RUNTIME: 'python37'
        ENTRYPOINT: 'main.handler'
        ENVIRONMENT: DEBUG=True,COUNT=1
        CLOUD_ID: ${{ secrets.CLOUD_ID }}
        FOLDER_ID: ${{ secrets.FOLDER_ID }}
        TOKEN: ${{ secrets.TOKEN }}
        BUCKET: ${{ secrets.BUCKET }}
        ACCESS_KEY: ${{ secrets.ACCESS_KEY }}
        SECRET_KEY: ${{ secrets.SECRET_KEY }}
Goodsmileduck commented 4 years ago

@sergeyzwezdin can you restart the last build? I added quotas for ENVIRONMENT value

sergeyzwezdin commented 4 years ago

@Goodsmileduck now works like a charm, thank you! 👏

It would be more convenient to setup it with with, but at least now it works, so it's up to you.

Thank you again :-)

Goodsmileduck commented 4 years ago

@sergeyzwezdin I not sure I understand how to use it, can you show example? I didn't find anything. Also if you have questions, you can drop me messages to telegram https://t.me/goodsmileduck And if you could help me with js to use nodejs-sdk for yandex cloud https://github.com/yandex-cloud/nodejs-sdk/blob/master/api/serverless/functions/v1/index.js we could rewrite action on javascript probably..

sergeyzwezdin commented 4 years ago

@Goodsmileduck It's input definition in action.yml - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputs

inputs:
  numOctocats:
    description: 'Number of Octocats'
    required: false
    default: '1'
  octocatEyeColor:
    description: 'Eye color of the Octocats'
    required: true

So if you define it in for action, next you can define these parameters in with section - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswith

I see that it's also available for docker actions - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-a-docker-container-action#create-an-action-metadata-file

sergeyzwezdin commented 4 years ago

And if you could help me with js to use nodejs-sdk for yandex cloud https://github.com/yandex-cloud/nodejs-sdk/blob/master/api/serverless/functions/v1/index.js we could rewrite action on javascript probably..

I'd happy to help, but do they have any documentation for the API? Couldn't find that