Skip to content

Commit 29237f6

Browse files
michaelsafyanLiudmila Molkova
andauthored
[chore] Make build fully support podman-is-docker. (open-telemetry#2080)
Co-authored-by: Liudmila Molkova <[email protected]>
1 parent 671b544 commit 29237f6

File tree

6 files changed

+147
-17
lines changed

6 files changed

+147
-17
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Build System Check
2+
3+
on:
4+
push:
5+
paths:
6+
- 'Makefile'
7+
- 'dependencies.Dockerfile'
8+
- 'internal/tools/**'
9+
pull_request:
10+
paths:
11+
- 'Makefile'
12+
- 'dependencies.Dockerfile'
13+
- 'internal/tools/**'
14+
15+
jobs:
16+
17+
# Ensure that invoking "make" without a specific build target will succeed.
18+
make-default-target:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
container-runner: ["docker", "podman"]
23+
steps:
24+
- name: install podman and podman-docker
25+
if: ${{ matrix.container-runner == 'podman' }}
26+
run: sudo apt-get install podman podman-docker
27+
28+
- name: check out code
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
31+
- name: install dependencies
32+
run: npm install
33+
34+
- name: invoke make
35+
run: make
36+
env:
37+
LYCHEE_GITHUB_TOKEN: ${{ github.token }}
38+
39+
40+
# The "CONTRIBUTING.md" guide provides these make targets for regenerating the files;
41+
# ensure that the steps in the "CONTRIBUTING.md" guide continue to work.
42+
make-generation-from-contributing-guide:
43+
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
container-runner: ["docker", "podman"]
47+
steps:
48+
- name: install podman and podman-docker
49+
if: ${{ matrix.container-runner == 'podman' }}
50+
run: sudo apt-get install podman podman-docker
51+
52+
- name: check out code
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
55+
- name: install dependencies
56+
run: npm install
57+
58+
- name: invoke make
59+
run: make table-generation attribute-registry-generation
60+
61+
# The "CONTRIBUTING.md" guide provides these make targets for verifying the policies;
62+
# ensure that the steps in the "CONTRIBUTING.md" guide continue to work.
63+
make-check-policies-from-contributing-guide:
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
container-runner: ["docker", "podman"]
68+
steps:
69+
- name: install podman and podman-docker
70+
if: ${{ matrix.container-runner == 'podman' }}
71+
run: sudo apt-get install podman podman-docker
72+
73+
- name: check out code
74+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
75+
76+
- name: install dependencies
77+
run: npm install
78+
79+
- name: invoke make
80+
run: make check-policies
81+
82+
# The "CONTRIBUTING.md" guide provides these make targets for doing a last minute full
83+
# check over the entire repo before attempting to send a PR. Make sure this succeeds.
84+
make-check-from-contributing-guide:
85+
runs-on: ubuntu-latest
86+
strategy:
87+
matrix:
88+
container-runner: ["docker", "podman"]
89+
steps:
90+
- name: install podman and podman-docker
91+
if: ${{ matrix.container-runner == 'podman' }}
92+
run: sudo apt-get install podman podman-docker
93+
94+
- name: check out code
95+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
96+
97+
- name: install dependencies
98+
run: npm install
99+
100+
- name: invoke make
101+
run: make check
102+
env:
103+
LYCHEE_GITHUB_TOKEN: ${{ github.token }}

.github/workflows/checks.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646

4747
- name: run markdown-link-check
4848
run: make markdown-link-check
49+
env:
50+
LYCHEE_GITHUB_TOKEN: ${{ github.token }}
4951

5052
markdown-toc-check:
5153
runs-on: ubuntu-latest
@@ -74,14 +76,16 @@ jobs:
7476
semantic-conventions:
7577
runs-on: ubuntu-latest
7678
steps:
77-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
79+
- name: check out code
80+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7881
- name: verify semantic convention tables
7982
run: make table-check
8083

8184
semantic-conventions-registry:
8285
runs-on: ubuntu-latest
8386
steps:
84-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
87+
- name: check out code
88+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8589
- name: verify registry tables
8690
run: |
8791
make attribute-registry-generation
@@ -90,7 +94,8 @@ jobs:
9094
schemas-check:
9195
runs-on: ubuntu-latest
9296
steps:
93-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
97+
- name: check out code
98+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9499
- name: verify schemas
95100
run: make schema-check
96101

@@ -106,14 +111,16 @@ jobs:
106111
policies-check:
107112
runs-on: ubuntu-latest
108113
steps:
109-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
114+
- name: check out code
115+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
110116
- name: verify semantic conventions yaml definitions
111117
run: make check-policies
112118

113119
polices-test:
114120
runs-on: ubuntu-latest
115121
steps:
116-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
122+
- name: check out code
123+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
117124
- name: verify semantic conventions yaml definitions
118125
run: make test-policies
119126

Makefile

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ else
1010
SED ?= sed
1111
endif
1212

13+
14+
ifeq ($(LYCHEE_GITHUB_TOKEN),)
15+
LYCHEE_GITHUB_TOKEN_ARG :=
16+
else:
17+
LYCHEE_GITHUB_TOKEN_ARG := --env GITHUB_TOKEN=$(LYCHEE_GITHUB_TOKEN)
18+
endif
19+
1320
TOOLS_DIR := $(PWD)/internal/tools
1421

1522
MARKDOWN_LINK_CHECK_ARG= # pass extra arguments such as --exclude '^http'
@@ -27,13 +34,15 @@ CONTAINER_REPOSITORY=docker.io
2734
WEAVER_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
2835
SEMCONVGEN_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
2936
OPA_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
37+
LYCHEE_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
3038

3139
# Versioned, non-qualified references to containers used in this Makefile.
3240
# These are parsed from dependencies.Dockerfile so dependabot will autoupdate
3341
# the versions of docker files we use.
3442
VERSIONED_WEAVER_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="weaver" {print $$2}')
3543
VERSIONED_SEMCONVGEN_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="semconvgen" {print $$2}')
3644
VERSIONED_OPA_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="opa" {print $$2}')
45+
VERSIONED_LYCHEE_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="lychee" {print $$2}')
3746

3847
# Fully qualified references to containers used in this Makefile. These
3948
# include the container repository, so that the build will work with tools
@@ -46,7 +55,7 @@ VERSIONED_OPA_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4==
4655
WEAVER_CONTAINER=$(WEAVER_CONTAINER_REPOSITORY)/$(VERSIONED_WEAVER_CONTAINER_NO_REPO)
4756
SEMCONVGEN_CONTAINER=$(SEMCONVGEN_CONTAINER_REPOSITORY)/$(VERSIONED_SEMCONVGEN_CONTAINER_NO_REPO)
4857
OPA_CONTAINER=$(OPA_CONTAINER_REPOSITORY)/$(VERSIONED_OPA_CONTAINER_NO_REPO)
49-
58+
LYCHEE_CONTAINER=$(LYCHEE_CONTAINER_REPOSITORY)/$(VERSIONED_LYCHEE_CONTAINER_NO_REPO)
5059

5160
CHECK_TARGETS=install-tools markdownlint misspell table-check compatibility-check \
5261
schema-check check-file-and-folder-names-in-docs
@@ -121,22 +130,23 @@ normalized-link-check:
121130

122131
.PHONY: markdown-link-check
123132
markdown-link-check: normalized-link-check
124-
# pinning lychee to 0.18.1
125133
$(DOCKER_RUN) --rm \
126-
--mount 'type=bind,source=$(PWD),target=/home/repo' \
127-
lycheeverse/lychee:sha-2aa22f8 \
134+
$(DOCKER_USER_IS_HOST_USER_ARG) \
135+
--mount 'type=bind,source=$(PWD),target=/home/repo' $(LYCHEE_GITHUB_TOKEN_ARG) \
136+
$(LYCHEE_CONTAINER) \
128137
--config home/repo/.lychee.toml \
129138
--root-dir /home/repo \
130139
--verbose \
140+
--timeout=60 \
131141
$(MARKDOWN_LINK_CHECK_ARG) \
132142
home/repo
133143

134144
.PHONY: markdown-link-check-changelog-preview
135145
markdown-link-check-changelog-preview:
136-
# pinning lychee to 0.18.1
137146
$(DOCKER_RUN) --rm \
138-
--mount 'type=bind,source=$(PWD),target=/home/repo' \
139-
lycheeverse/lychee:sha-2aa22f8 \
147+
$(DOCKER_USER_IS_HOST_USER_ARG) \
148+
--mount 'type=bind,source=$(PWD),target=/home/repo' $(LYCHEE_GITHUB_TOKEN_ARG) \
149+
$(LYCHEE_CONTAINER) \
140150
--config /home/repo/.lychee.toml \
141151
--root-dir /home/repo \
142152
--verbose \
@@ -212,6 +222,7 @@ attribute-registry-generation:
212222
.PHONY: table-check
213223
table-check:
214224
$(DOCKER_RUN) --rm \
225+
$(DOCKER_USER_IS_HOST_USER_ARG) \
215226
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
216227
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
217228
--mount 'type=bind,source=$(PWD)/docs,target=/home/weaver/target,readonly' \
@@ -300,6 +311,10 @@ LATEST_RELEASED_SEMCONV_VERSION := $(shell git ls-remote --tags https://github.c
300311
.PHONY: check-policies
301312
check-policies:
302313
$(DOCKER_RUN) --rm \
314+
$(DOCKER_USER_IS_HOST_USER_ARG) \
315+
--env USER=weaver \
316+
--env HOME=/home/weaver \
317+
-v $(shell mktemp -d):/home/weaver/.weaver \
303318
--mount 'type=bind,source=$(PWD)/policies,target=/home/weaver/policies,readonly' \
304319
--mount 'type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
305320
${WEAVER_CONTAINER} registry check \
@@ -310,7 +325,7 @@ check-policies:
310325
# Test rego policies
311326
.PHONY: test-policies
312327
test-policies:
313-
$(DOCKER_RUN) --rm -v $(PWD)/policies:/policies -v $(PWD)/policies_test:/policies_test \
328+
$(DOCKER_RUN) --rm $(DOCKER_USER_IS_HOST_USER_ARG) -v $(PWD)/policies:/policies -v $(PWD)/policies_test:/policies_test \
314329
${OPA_CONTAINER} test \
315330
--var-values \
316331
--explain fails \
@@ -321,5 +336,5 @@ test-policies:
321336
# once github action requirements are updated.
322337
.PHONY: compatibility-check
323338
compatibility-check:
324-
$(DOCKER_RUN) --rm -v $(PWD)/model:/source -v $(PWD)/docs:/spec --pull=always \
339+
$(DOCKER_RUN) --rm $(DOCKER_USER_IS_HOST_USER_ARG) -v $(PWD)/model:/source -v $(PWD)/docs:/spec --pull=always \
325340
$(SEMCONVGEN_CONTAINER) --continue-on-validation-errors -f /source compatibility --previous-version $(LATEST_RELEASED_SEMCONV_VERSION)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# <img src="https://opentelemetry.io/img/logos/opentelemetry-logo-nav.png" alt="OpenTelemetry Icon" width="45" height=""> OpenTelemetry Semantic Conventions
22

3-
[![Checks](https://github.com/open-telemetry/semantic-conventions/workflows/Checks/badge.svg?branch=main)](https://github.com/open-telemetry/semantic-conventions/actions?query=workflow%3A%22Checks%22+branch%3Amain)
3+
[![Checks](https://github.com/open-telemetry/semantic-conventions/workflows/Checks/badge.svg)](https://github.com/open-telemetry/semantic-conventions/actions?query=workflow%3A%22Checks%22+branch%3Amain)
44
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/open-telemetry/semantic-conventions.svg?logo=opentelemetry&&color=f5a800&label=Latest%20release)](https://github.com/open-telemetry/semantic-conventions/releases/latest)
55
[![Specification Version](https://img.shields.io/badge/OTel_specification_version-v1.44.0-blue?logo=opentelemetry&color=f5a800)](https://github.com/open-telemetry/opentelemetry-specification/releases/tag/v1.44.0)
66

dependencies.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ FROM openpolicyagent/opa:1.3.0@sha256:e02dc1957f7a4195f0724762269dfe3309f1334462
1111
# Semconv gen is used for backwards compatibility checks.
1212
# TODO(jsuereth): Remove this when no longer used.
1313
FROM otel/semconvgen:0.25.0@sha256:9df7b8cbaa732277d64d0c0a8604d96bb6f5a36d0e96338cba5dced720c16485 AS semconvgen
14+
15+
# Lychee is used for checking links in documentation.
16+
FROM lycheeverse/lychee:sha-2aa22f8@sha256:07abefbbc446f9987f9a1f05016e620983c7c70889ee5a1fd00a749d8f53352e AS lychee

internal/tools/schema_check.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ for file in $schemas_dir/*; do
8484
exit 2
8585
fi
8686

87-
docker run -v $schemas_dir:/schemas \
88-
otel/build-tool-schemas:$BUILD_TOOL_SCHEMAS_VERSION --file /schemas/$ver --version=$ver
87+
PODMAN_USERNS=keep-id docker run \
88+
-u $(id -u):$(id -g) \
89+
-v $schemas_dir:/schemas \
90+
docker.io/otel/build-tool-schemas:$BUILD_TOOL_SCHEMAS_VERSION --file /schemas/$ver --version=$ver
8991

9092
echo "OK"
9193
done

0 commit comments

Comments
 (0)