Allow workflow-specific secrets

#1

Allow workflow-specific secrets, similar to environment variables.

At the moment, if I have several different workflows that each uploads to a different place, I need to create secrets for each one with different names, also requiring me to change my upload script for each workflow (instead of using a generic one with the same variables).

0 Likes

#2

Thanks for the #feature-request @Roboteam! It makes perfect sense, but don’t forget to vote for this!

0 Likes

#3

@Roboteam in my projects add https://gist.github.com/ramonornela/2e683e4fde6df66dca88972412dc52ef, should i export to step

Todo

Implements in file secrets Generic Storage

0 Likes

#4

Hi @ramonornela!

This thread is a feature request towards Bitrise to offer the option to allow workflow specific secrets.Can you elaborate on your message please? :slight_smile:

0 Likes

#5

Maybe a step fix with rules: read Generic File or External File and Set ENV via envman

dev:
after_run:
- _set-env-vars-file
envs:
- ENV_FILE: $BITRISEIO_ENV_FILE_DEV_URL
_set-env-vars-file:
steps:
- script:
    inputs:
    - title: "Set env vars file"
    - content: |
        #!/bin/bash
        if [ -n "$ENV_FILE" ]; then
          # specify local download path
          file_local_path=$BITRISE_SOURCE_DIR/file_env
          # download the file
          wget -O "$file_local_path" "$ENV_FILE"
          filename="$file_local_path"
          # set vars define by env file in generic file storage
          while IFS= read -r var
          do
            if [[ $var =~ "=" ]]; then
              key=${var%%=*}
              value=${var#*=}
              valueDefault=${!key}
              if [ -n "$value" ] && [ -z "$valueDefault" ]; then
                echo "Set var: $key"
                envman add --key $key --value $value
              fi
            fi
          done < "$filename"
        fi

More a propose add scope similar https://docs.gitlab.com/ee/ci/variables/#limiting-environment-scopes-of-environment-variables-premium

0 Likes