Passing environment variables between tasks

Is it possible to gather an environment variable from within a running task and pass it to a resource?

For example:

    # Jobs
    jobs:
      - name: thing-doer
        public: true
        on_success:
          put: irc-resource
          params:
            message: "${COOL_THING}"
        on_failure:
          put: irc-resource
          params:
            message: "${COOL_THING}"
        plan:
          - task: build ((branch)) @((profile))-((media))
            config:
              platform: linux
              run:
                path: /bin/bash
                args:
                  - -c
                  - |
                     export COOL_THING=TEST

In essence, I need to pass the environment variable in the task to the resource. (The resource in question when run actually substitutes "{COOL_THING}" with an environment variable.. such as {BUILD_TEAM_NAME})

No, that’s not possible, as the resource’s config is evaluated at set-pipeline time, and not at runtime. You’d need the resource to accept input from a file (this is the one way of transferring state between steps in a job), and if you’re using flavorjones/irc-notification-resource then that’s not the case.

It should be fairly easy to PR into the resource though, and I think some of the email-sending resources do this.

HA. We rolled our own :slight_smile: which doesn’t join / part every notification :slight_smile:

https://github.com/haiku/irccat-resource

So… anything is possible. I could “source” a file provided and substitute the environment variables.