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

Local shell #169

Merged
merged 3 commits into from
Feb 1, 2024
Merged

Local shell #169

merged 3 commits into from
Feb 1, 2024

Conversation

umputun
Copy link
Owner

@umputun umputun commented Feb 1, 2024

This PR adds a new top-level field to playbooks (both full and simplified versions), allowing to set the local shell (i.e. local_shell=/bin/bash)

This is because there are unpredictable and unexpected results if we run some scripts with local mode on a different host. For example, this simple script works fine with #/bin/sh but doesn't work correctly with #/bin/zsh

  - name: "make images"
    script: |
     IMAGES="website email-sender private-share"
      mkdir -p /tmp/web-images
      for image in ${IMAGES}; do
        echo "process image: ${image}"
        docker pull  example.com/miscs/${image}:latest
        docker save "example.com/miscs/${image}" -o "/tmp/web-images/${image}.tar"
      done
    options: {local: true}

The change is back compatible, i.e., if local_shell is not set, it will follow the old logic (os.Getenv("SHELL") with failback to /bin/sh)

@umputun umputun merged commit 31d6e74 into master Feb 1, 2024
4 checks passed
@umputun umputun deleted the local-shell branch February 1, 2024 20:43
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

Successfully merging this pull request may close these issues.

1 participant