构建阶段:通过 S3 共享文件
此示例具有 2 个构建阶段
- 两个在 S3 上设置文件的作业。
- 一个使用阶段 1 中两个文件的作业。
以下是 .travis.yml
配置可能的样子
dist: xenial
env:
global:
# include $HOME/.local/bin for `aws`
- PATH=$HOME/.local/bin:$PATH
before_install:
- pyenv global 3.7.1
- pip install -U pip
- pip install awscli
- mkdir -p ~/$TRAVIS_BUILD_NUMBER
- aws s3 sync s3://travis-build-stages-shared-storage-test/$TRAVIS_BUILD_NUMBER ~/$TRAVIS_BUILD_NUMBER
jobs:
include:
- stage: setup files
script: echo one | tee > ~/$TRAVIS_BUILD_NUMBER/one
- stage: setup files
script: echo two | tee > ~/$TRAVIS_BUILD_NUMBER/two
- stage: use shared files
script:
- cat ~/$TRAVIS_BUILD_NUMBER/*
after_success:
- aws s3 rm --recursive s3://travis-build-stages-shared-storage-test/$TRAVIS_BUILD_NUMBER # clean up after ourselves
after_success:
- aws s3 sync ~/$TRAVIS_BUILD_NUMBER s3://travis-build-stages-shared-storage-test/$TRAVIS_BUILD_NUMBER
构建矩阵将如下所示
您可以在我们的 演示存储库 中找到此示例的代码