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

Some configurations/features are ignored if you do not use copy_stack_file #6

Open
michaelfeinbier opened this issue Aug 26, 2020 · 2 comments

Comments

@michaelfeinbier
Copy link

Hi there,

first of all thanks for your work here.
I'm using the following configuration for my action

  deploy:
    needs: push
    runs-on: ubuntu-latest
    if: github.event_name == 'push'
    steps:
      - uses: actions/checkout@v2
      - name: Deploy to Docker Host
        uses: wshihadeh/docker-deployment-action@master
        env:
          MONGO_URL: ${{ secrets.MONGO_URL }}
        with:
          remote_docker_host: root@.....
          ssh_private_key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
          ssh_public_key: ${{ secrets.DOCKER_SSH_PUBLIC_KEY }}
          deployment_mode: docker-compose
          args: up -d
          docker_prune: false
          pull_images_first: true
          pre_deployment_command_args: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

I realized that the input configs pull_images_first and pre_deployment_command_args are completely ignored.
Looking at the code it looks to me that both configs will only work if you set the copy_stack_file option to TRUE because you nested the whole logic in this condition if ! [ -z "$INPUT_COPY_STACK_FILE" ] && [ $INPUT_COPY_STACK_FILE = 'true' ] ; then

Not sure if this is intended or not but for me, there is no reason to make this functionality only available if you copy over the stack file?! It should work as well even without copying the files?
If it was intended, you should maybe update the documentation to reflect this limitation.

Additionally: In some places, you check conditions like this [ $INPUT_DEPLOYMENT_MODE = 'docker-compose' ] but if you never set deployment_mode explicitly to docker-compose this input var will never have the value as you never set the fallback explicitly.

If you say that this behaviour was not intended I'm happy to provide a PR to fix it :)

@wshihadeh
Copy link
Owner

Thanks for the feedback, pull first + pre deployment args was intended only to be used in the case we copy the file (I will take a look and try to improve this). for the second point, it seems that I forgot to check the input and provide a default value :( . i will update it also

@wshihadeh wshihadeh reopened this Nov 13, 2020
@GH-Sensemaking
Copy link

can

  if ! [ -z "$INPUT_PULL_IMAGES_FIRST" ] && [ $INPUT_PULL_IMAGES_FIRST = 'true' ] && [ $INPUT_DEPLOYMENT_MODE = 'docker-compose' ] ; then
    execute_ssh ${DEPLOYMENT_COMMAND} "pull"
  fi

  if ! [ -z "$INPUT_PRE_DEPLOYMENT_COMMAND_ARGS" ] && [ $INPUT_DEPLOYMENT_MODE = 'docker-compose' ] ; then
    execute_ssh "${DEPLOYMENT_COMMAND}  $INPUT_PRE_DEPLOYMENT_COMMAND_ARGS" 2>&1
  fi

be added when INPUT_COPY_STACK_FILE is false? I cant find a way to pull the latest images otherwise.

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

3 participants