Skip to content
    • This snippet contains error - all aliases must be defined before they used. In fact, now it's not a valid yaml.

      But if we define alias jobs first, and then define test, everything works.

      stages:
        - test
      
      # aliases must be defined before they used
      .script-1: &script-1 |
        # This is a shell multi-line script to be included
        export S1_RANDOM=$(cat /dev/urandom | LC_TYPE=C tr -dc "[:alpha:]" | head -c 16)
        echo "random: $S1_RANDOM"
      
      .script-2: &script-2 |
        # This is a shell multi-line script to be included
        export S2_RANDOM=$(cat /dev/urandom | LC_TYPE=C tr -dc "[:alpha:]" | head -c 16)
        echo "random: $S2_RANDOM"
      
      test:
        stage: test
        image: alpine
        script:
          - *script-1
          - *script-2
    • Please register or sign in to reply
  • Is it possible to use something like this inside multiline script.

    if [[ ! -z "$DEBUG" ]] && [[ "$DEBUG" == "true" ]]; then
    	JPDA="jpda"
      export JPDA_SUSPEND=y
      export JPDA_ADDRESS=0.0.0.0:8000
    fi```
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment