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

Long one line command can be divided into more lines with '>-' #319

Open
mimimalizam opened this issue Feb 25, 2019 · 1 comment
Open

Long one line command can be divided into more lines with '>-' #319

mimimalizam opened this issue Feb 25, 2019 · 1 comment
Labels
reference All about configuring Semaphore

Comments

@mimimalizam
Copy link
Contributor

mimimalizam commented Feb 25, 2019

One user recently asked for a way to divide a long one-line command and it can be achieved by writing the line in the folded style (>) and by stripping the line break in the yaml file (-). To do this, we can start the command with line containing only >- and write the command in more lines below it.

https://yaml.org/spec/1.2/spec.html#Block

Example yaml:

version: "v1.0"
name: First pipeline example
agent:
  machine:
    type: e1-standard-2
    os_image: ubuntu1804

blocks:
  - name: "First block"
    task:
      jobs:
      - name: Divide one line command
        commands:
          - >- 
            sudo apt-get install -y
            htop
            git
            curl
            wget
@markoa markoa assigned mactsouk and unassigned markoa Mar 8, 2019
@markoa markoa added the reference All about configuring Semaphore label Mar 8, 2019
@markoa
Copy link
Contributor

markoa commented Mar 20, 2019

I recommend the example to contain a multiline Bash if statement. I was blown away when I saw it's possible to write it like that in yml. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reference All about configuring Semaphore
Projects
None yet
Development

No branches or pull requests

3 participants