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@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 - name: Login to DockerHub uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.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@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 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@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . file: ./scripts/environment/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}