Skip to content

Commit c87dcad

Browse files
authored
[CI] Publish site-build info under /site (#3111)
1 parent d994dfc commit c87dcad

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

‎content/en/site/_index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Website information
3+
likeTitle: Site info
4+
cascade: { type: docs }
5+
---
6+
7+
{{% site-build-info %}}

‎hugo.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# cSpell:ignore docsy goldmark netlify wordmark
12
baseURL: https://opentelemetry.io
23
title: &title OpenTelemetry
34
description: &desc The OpenTelemetry Project Site
@@ -15,7 +16,7 @@ languages:
1516
title: *title
1617
description: *desc
1718
imaging:
18-
resampleFilter: CatmullRom
19+
resampleFilter: CatmullRom # cspell:disable-line
1920
quality: 75
2021
anchor: smart
2122

@@ -131,6 +132,9 @@ params:
131132
desc: >-
132133
Important information on how to represent your personal or corporate
133134
contributions or participation in the OpenTelemetry project.
135+
- name: Site-build info
136+
url: /site/
137+
icon: fa-solid fa-hammer
134138

135139
logos:
136140
hero: opentelemetry-horizontal-color.png
@@ -159,7 +163,7 @@ params:
159163
icon: far fa-envelope
160164

161165
fonts:
162-
- name: Noto Sans
166+
- name: Noto Sans # cspell:disable-line
163167
sizes: [300, 400, 600, 700]
164168
type: sans_serif
165169

@@ -175,6 +179,12 @@ services:
175179
# https://github.com/open-telemetry/opentelemetry.io/issues/1626.
176180
id: UA-00000000-0 # TODO: switch to G-0000000000 once we get confirmation that it's ok to do so
177181

182+
security:
183+
funcs: # cspell:disable-line
184+
getenv: # cspell:disable-line
185+
# Netlify build env var
186+
- ^(BRANCH|BUILD_ID|COMMIT_REF|CONTEXT|DEPLOY_ID|NETLIFY|PULL_REQUEST|REVIEW_ID)$
187+
178188
module:
179189
mounts:
180190
- source: content/en

‎layouts/shortcodes/site-build-info.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{{/* cSpell:ignore getenv substr */ -}}
2+
3+
{{ $branch := os.Getenv "BRANCH" -}}
4+
{{ $buildID := os.Getenv "BUILD_ID" -}}
5+
{{ $commitRef := os.Getenv "COMMIT_REF" -}}
6+
{{ $deployID := os.Getenv "DEPLOY_ID" -}}
7+
{{ $isNetlifyBuilt := os.Getenv "NETLIFY" | default false -}}
8+
{{ $isPR := os.Getenv "PULL_REQUEST" -}}
9+
{{ $reviewID := os.Getenv "REVIEW_ID" -}}
10+
11+
Netlify build information:
12+
13+
| Attribute | Value |
14+
|---|---|
15+
Netlify built | `{{ $isNetlifyBuilt }}`
16+
{{/* */ -}}
17+
18+
{{/* Don't show timestamp for local builds to avoid affecting site diffs. */ -}}
19+
{{ with $isNetlifyBuilt -}}
20+
Date/time[^date] | {{ now.Format "2006-01-02 15:04" }}
21+
{{ end -}}
22+
{{/* */ -}}
23+
24+
{{ with $buildID -}}
25+
ID | `{{.}}`
26+
{{ end -}}
27+
{{/* */ -}}
28+
29+
{{ with $deployID -}}
30+
Deploy log | [{{ . }}](https://app.netlify.com/teams/opentelemetry/builds/{{ . }})
31+
{{ end -}}
32+
{{/* */ -}}
33+
34+
{{ with $reviewID -}}
35+
Build context |
36+
{{- if $isPR -}}
37+
[PR #{{ . }}](https://github.com/open-telemetry/opentelemetry.io/pull/{{ . }})
38+
{{ else -}}
39+
merge `{{ . }}`
40+
{{ end -}}
41+
{{ end -}}
42+
{{/* */ -}}
43+
44+
Deploy context | {{ os.Getenv "CONTEXT" | default "local" }}
45+
{{/* */ -}}
46+
47+
{{ with $commitRef -}}
48+
Commit | [@{{substr . 0 7 }}](https://github.com/open-telemetry/opentelemetry.io/commit//{{ . }})
49+
{{ end -}}
50+
{{/* */ -}}
51+
52+
{{ with $branch -}}
53+
Branch | `{{ . }}`
54+
{{ end -}}
55+
{{/* End of table */}}
56+
57+
[^date]: Approximate build timestamp.

0 commit comments

Comments
 (0)