Environment Suite #29559
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Environment Suite | |
| on: | |
| workflow_call: | |
| inputs: | |
| ref: | |
| description: 'Git ref to checkout' | |
| required: false | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| push: | |
| description: "Push image when manually triggered" | |
| type: boolean | |
| default: false | |
| ref: | |
| description: 'Git ref to checkout' | |
| required: false | |
| type: string | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 06:00 UTC | |
| env: | |
| VERBOSE: true | |
| CI: true | |
| SHOULD_PUBLISH: ${{ (github.event_name != 'workflow_dispatch' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_dispatch' && github.event.inputs.push == 'true') }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish-new-environment: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout branch | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | |
| if: env.SHOULD_PUBLISH == 'true' | |
| with: | |
| username: ${{ secrets.CI_DOCKER_USERNAME }} | |
| password: ${{ secrets.CI_DOCKER_PASSWORD }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 | |
| with: | |
| images: timberio/vector-dev | |
| flavor: | | |
| latest=true | |
| tags: type=sha, format=long | |
| labels: | | |
| org.opencontainers.image.description=Image for Vector's Docker development environment | |
| org.opencontainers.image.source=https://github.com/vectordotdev/vector/tree/master/scripts/environment/Dockerfile | |
| org.opencontainers.image.title=Vector development environment | |
| org.opencontainers.image.url=https://github.com/vectordotdev/vector | |
| - name: Free disk space | |
| shell: bash | |
| run: sudo -E bash scripts/ci-free-disk-space.sh | |
| - name: Build image (no push) | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| file: ./scripts/environment/Dockerfile | |
| load: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Test built image | |
| run: | | |
| IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1) | |
| echo "Running build test inside container: ${IMAGE_TAG}" | |
| docker run --rm \ | |
| -v "${GITHUB_WORKSPACE}:/src" \ | |
| -w /src \ | |
| "${IMAGE_TAG}" \ | |
| cargo run --bin vector -- --version | |
| - name: Push image | |
| if: env.SHOULD_PUBLISH == 'true' | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| file: ./scripts/environment/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |