-
Notifications
You must be signed in to change notification settings - Fork 2.1k
110 lines (98 loc) · 4.13 KB
/
environment.yml
File metadata and controls
110 lines (98 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Environment Suite
on:
workflow_call:
workflow_dispatch:
inputs:
push:
description: "Push image when manually triggered"
type: boolean
default: false
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:
statuses: write
jobs:
publish-new-environment:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: (PR review) Set latest commit status as pending
if: ${{ github.event_name == 'pull_request_review' }}
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
with:
sha: ${{ github.event.review.commit_id }}
token: ${{ secrets.GITHUB_TOKEN }}
context: Environment Suite
status: pending
- name: (PR review) Checkout PR branch
if: ${{ github.event_name == 'pull_request_review' }}
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event.review.commit_id }}
- name: Checkout branch
if: ${{ github.event_name != 'pull_request_review' }}
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Login to DockerHub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.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@318604b99e75e41977312d83839a89be02ca4893 # v5.9.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 }}
- name: (PR review) Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
if: always() && github.event_name == 'pull_request_review'
with:
sha: ${{ github.event.review.commit_id }}
token: ${{ secrets.GITHUB_TOKEN }}
context: Environment Suite
status: ${{ job.status }}