4

I would like to use the free online service transfer.sh for sharing build artifacts between stages in travis ci. While uploading/downloading is easy, the problem is that the resulting URL contains a non-predictable part and hence, the whole URL becomes non-predictable.

When uploading artifacts in an early stage, I need to pass the resulting URLs to later stages. AFAIK, jobs in a multi-stage build are strictly isolated from each other.

  • Thus, I am looking for ideas how to do pass URLs between stages.
  • Ideas how to pass artifacts with (registration-)free services would be also welcome.
Richard W
  • 631
  • 4
  • 15

1 Answers1

2

I found a solution for passing artifacts between build stages on Travis-CI: Abuse github releases.

  1. Create a tag in the github repo, e.g. "travis-ci"
  2. In the .travis.yml, set TRAVIS_TAG=travis-ci.
  3. Add a deployment (deploy to github) step to the stages that need to store artifacts. Create and use an encrypted github token for authentication. That works even on Windows hosts which have secret environment variables disabled. This step needs the TRAVIS_TAG because otherwise it will create a new tag which we don't want.
  4. Include the current TRAVIS_BUILD_NUMBER in each file name
  5. In a later stage, use to curl to download the artifact, because the URL is now predictable.

When building a tag, one could omit overriding TRAVIS_TAG and use that particular tag for storing intermediate artifacts. One could then remove them later manually.

[EDIT] I just noticed that Travis introduced a feature called workspaces which is exactly what I wanted. No need for above workaround.

Richard W
  • 631
  • 4
  • 15
  • You've set me off in the right direction thank you! But can I ask about using github releases for build artifacts? Did you have to allow build artifacts in your `.gitignore`? Not sure how I feel about this – Daniel Cooke Jan 22 '20 at 12:51
  • 1
    No, the release artifacts are not stored in the git repo and thus, `.gitignore` should not have anything to do with that. But it sounds like you want to abuse a/the git repository itself to store artifacts. I haven't thought of this, might be worth a try. – Richard W Jan 23 '20 at 13:27
  • 1
    @DanielCooke, you may want to try [Travis workspaces](https://docs.travis-ci.com/user/using-workspaces/). – Richard W Apr 29 '20 at 21:21
  • Yep! so not long after posting here - I discovered this feature. Unfortunately, this is not yet supported on Github Enterprise . We resorted to a much better solution - a custom server to store build info permanently – Daniel Cooke Apr 30 '20 at 11:16