Is the git reference exposed to the imported Travis Shared Build Configs?

Regarding https://docs.travis-ci.com/user/build-config-imports

I currently maintain https://github.com/bevry/awesome-travis which has several scripts that be added to a .travis.yml file, such as https://github.com/bevry/awesome-travis/blob/master/scripts/node-install.bash which is added by doing:

install:
  - eval "$(curl -fsSL https://raw.githubusercontent.com/bevry/awesome-travis/c91c9d5eef34ecb0e92029667fd5052640225fa3/scripts/node-install.bash)"

I am considering putting the above into a node-install.yml file that can then be imported via:

import:
  - bevry/awesome-travis:node-install.yml@c91c9d5eef34ecb0e92029667fd5052640225fa3

However, it would be frustrating for me to have to update bevry/awesome-travis:node-install.yml on every single update with the latest commit hash.

I could omit the commit information, but that would be dangerous to the stability of people’s CI builds.

It would be nice if merging provided an environment variable that is replaced on merge, something like:

install:
  - eval "$(curl -fsSL https://raw.githubusercontent.com/bevry/awesome-travis/$TRAVIS_CONFIG_REFERENCE/scripts/node-install.bash)"

Such that doing

import:
  - bevry/awesome-travis:node-install.yml@c91c9d5eef34ecb0e92029667fd5052640225fa3

Replaces $TRAVIS_CONFIG_REFERENCE with c91c9d5eef34ecb0e92029667fd5052640225fa3 on merge.

Or:

import:
  - bevry/awesome-travis:node-install.yml@master

Replaces $TRAVIS_CONFIG_REFERENCE with master on merge.

Not a good idea. Because you can’t import parts of a list section, only insert or replace it in full – and such a command is likely to be only a part of an install/script section’s logic.

2 Likes

This can be closed. I moved to Github Actions, which has native composability.