-
Notifications
You must be signed in to change notification settings - Fork 530
169 lines (146 loc) · 5.4 KB
/
docker.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: docker
on:
push:
branches:
- 'main'
- 'r[0-9]+'
tags:
- 'v*'
# Needed to login to DockerHub
permissions:
contents: read
id-token: write
jobs:
get-tag:
if: github.repository == 'grafana/tempo' # skip in forks
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: fetch tags
run: git fetch --tags
- id: get-tag
run: |
echo "tag=$(./tools/image-tag)" >> "$GITHUB_OUTPUT"
docker:
if: github.repository == 'grafana/tempo'
needs: get-tag
strategy:
matrix:
component: [ tempo, tempo-vulture, tempo-query, tempo-cli ]
runner_arch: [ { runner: ubuntu-24.04, arch: amd64 }, { runner: github-hosted-ubuntu-arm64, arch: arm64 } ]
runs-on: ${{ matrix.runner_arch.runner }}
env:
TAG: ${{ needs.get-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: fetch tags
run: git fetch --tags
- name: build-tempo-binaries
run: |
COMPONENT=${{ matrix.component }} GOARCH=${{ matrix.runner_arch.arch }} make exe
- name: docker-build
run: |
TAG_ARCH="$TAG-${{ matrix.runner_arch.arch }}"
docker build -f cmd/${{ matrix.component }}/Dockerfile -t grafana/${{ matrix.component }}:$TAG_ARCH .
- name: Login to DockerHub
uses: grafana/shared-workflows/actions/[email protected]
- name: docker-push
run: |
TAG_ARCH="$TAG-${{ matrix.runner_arch.arch }}"
docker push grafana/${{ matrix.component }}:$TAG_ARCH
manifest:
if: github.repository == 'grafana/tempo'
needs: ['get-tag', 'docker']
strategy:
matrix:
component: [ tempo, tempo-vulture, tempo-query, tempo-cli ]
runs-on: ubuntu-24.04
env:
TAG: ${{ needs.get-tag.outputs.tag }}
IMAGE_NAME: grafana/${{ matrix.component }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
uses: grafana/shared-workflows/actions/[email protected]
- name: docker-manifest-create-and-push
run: |
docker manifest create \
$IMAGE_NAME:$TAG \
--amend $IMAGE_NAME:$TAG-amd64 \
--amend $IMAGE_NAME:$TAG-arm64
docker manifest push $IMAGE_NAME:$TAG
docker manifest create \
$IMAGE_NAME:latest \
--amend $IMAGE_NAME:$TAG-amd64 \
--amend $IMAGE_NAME:$TAG-arm64
docker manifest push $IMAGE_NAME:latest
cd-to-dev-env:
# This job deploys the latest main commit to the dev environment
if: github.repository == 'grafana/tempo' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
needs: manifest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: fetch tags
run: git fetch --tags
- name: get-tag
run: |
echo "grafana/tempo:$(./tools/image-tag)" > tags_for_cd_tempo
echo "grafana/tempo-query:$(./tools/image-tag)" > tags_for_cd_tempo_query
echo "grafana/tempo-vulture:$(./tools/image-tag)" > tags_for_cd_tempo_vulture
- name: Authenticate to GAR
uses: grafana/shared-workflows/actions/login-to-gar@main
id: login-to-gar
with:
registry: us-docker.pkg.dev
environment: prod
- name: Get Vault secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
common_secrets: |
GITHUB_APP_ID=updater-app:app-id
GITHUB_APP_INSTALLATION_ID=updater-app:app-installation-id
GITHUB_APP_PRIVATE_KEY=updater-app:private-key
- name: Update jsonnet
run: |
set -e -o pipefail
cat << EOF > config.json
{
"destination_branch": "master",
"pull_request_branch_prefix": "auto-merge/cd-tempo-dev",
"pull_request_enabled": true,
"pull_request_existing_strategy": "ignore",
"repo_name": "deployment_tools",
"update_jsonnet_attribute_configs": [
{
"file_path": "ksonnet/environments/tempo/dev-us-central-0.tempo-dev-01/images.libsonnet",
"jsonnet_key": "tempo",
"jsonnet_value_file": "tags_for_cd_tempo"
},
{
"file_path": "ksonnet/environments/tempo/dev-us-central-0.tempo-dev-01/images.libsonnet",
"jsonnet_key": "tempo_query",
"jsonnet_value_file": "tags_for_cd_tempo_query"
},
{
"file_path": "ksonnet/environments/tempo/dev-us-central-0.tempo-dev-01/images.libsonnet",
"jsonnet_key": "tempo_vulture",
"jsonnet_value_file": "tags_for_cd_tempo_vulture"
}
]
}
EOF
docker run --rm \
-e GITHUB_APP_ID \
-e GITHUB_APP_INSTALLATION_ID \
-e GITHUB_APP_PRIVATE_KEY \
-e CONFIG_JSON="$(cat config.json)" \
-v ./tags_for_cd_tempo:/app/tags_for_cd_tempo \
-v ./tags_for_cd_tempo_query:/app/tags_for_cd_tempo_query \
-v ./tags_for_cd_tempo_vulture:/app/tags_for_cd_tempo_vulture us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/updater