@@ -48,11 +48,28 @@ SEMCONVGEN_CONTAINER=$(SEMCONVGEN_CONTAINER_REPOSITORY)/$(VERSIONED_SEMCONVGEN_C
48
48
OPA_CONTAINER =$(OPA_CONTAINER_REPOSITORY ) /$(VERSIONED_OPA_CONTAINER_NO_REPO )
49
49
50
50
51
- DOCKER_USER =$(shell id -u) :$(shell id -g)
52
-
53
51
CHECK_TARGETS =install-tools markdownlint misspell table-check compatibility-check \
54
52
schema-check check-file-and-folder-names-in-docs
55
53
54
+ # Determine if "docker" is actually podman
55
+ DOCKER_IS_PODMAN =$(docker --version | grep podman | wc -l )
56
+ ifeq ($(DOCKER_IS_PODMAN ) ,0)
57
+ DOCKER_COMMAND =docker
58
+ else
59
+ DOCKER_COMMAND =podman
60
+ endif
61
+
62
+ DOCKER_RUN =$(DOCKER_COMMAND ) run
63
+ DOCKER_USER =$(shell id -u) :$(shell id -g)
64
+ DOCKER_USER_IS_HOST_USER_ARG =-u $(DOCKER_USER )
65
+ ifeq ($(DOCKER_COMMAND ) ,podman)
66
+ # On podman, additional arguments are needed to make "-u" work
67
+ # correctly with the host user ID and host group ID.
68
+ #
69
+ # Error: OCI runtime error: crun: setgroups: Invalid argument
70
+ DOCKER_USER_IS_HOST_USER_ARG=--userns =keep-id -u $(DOCKER_USER )
71
+ endif
72
+
56
73
57
74
# TODO: add `yamllint` step to `all` after making sure it works on Mac.
58
75
.PHONY : all
@@ -95,7 +112,7 @@ normalized-link-check:
95
112
96
113
.PHONY : markdown-link-check
97
114
markdown-link-check : normalized-link-check
98
- docker run --rm \
115
+ $( DOCKER_RUN ) --rm \
99
116
--mount ' type=bind,source=$(PWD),target=/home/repo' \
100
117
lycheeverse/lychee \
101
118
--config home/repo/.lychee.toml \
@@ -106,7 +123,7 @@ markdown-link-check: normalized-link-check
106
123
107
124
.PHONY : markdown-link-check-changelog-preview
108
125
markdown-link-check-changelog-preview :
109
- docker run --rm \
126
+ $( DOCKER_RUN ) --rm \
110
127
--mount ' type=bind,source=$(PWD),target=/home/repo' \
111
128
lycheeverse/lychee \
112
129
--config /home/repo/.lychee.toml \
@@ -153,8 +170,8 @@ yamllint:
153
170
# Generate markdown tables from YAML definitions
154
171
.PHONY : table-generation
155
172
table-generation :
156
- docker run --rm \
157
- -u $( DOCKER_USER ) \
173
+ $( DOCKER_RUN ) --rm \
174
+ $( DOCKER_USER_IS_HOST_USER_ARG ) \
158
175
--mount ' type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
159
176
--mount ' type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
160
177
--mount ' type=bind,source=$(PWD)/docs,target=/home/weaver/target' \
@@ -169,8 +186,8 @@ table-generation:
169
186
# Generate attribute registry markdown.
170
187
.PHONY : attribute-registry-generation
171
188
attribute-registry-generation :
172
- docker run --rm \
173
- -u $( DOCKER_USER ) \
189
+ $( DOCKER_RUN ) --rm \
190
+ $( DOCKER_USER_IS_HOST_USER_ARG ) \
174
191
--mount ' type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
175
192
--mount ' type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
176
193
--mount ' type=bind,source=$(PWD)/docs,target=/home/weaver/target' \
@@ -183,7 +200,7 @@ attribute-registry-generation:
183
200
# Check if current markdown tables differ from the ones that would be generated from YAML definitions (weaver).
184
201
.PHONY : table-check
185
202
table-check :
186
- docker run --rm \
203
+ $( DOCKER_RUN ) --rm \
187
204
--mount ' type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
188
205
--mount ' type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
189
206
--mount ' type=bind,source=$(PWD)/docs,target=/home/weaver/target,readonly' \
@@ -242,8 +259,8 @@ chlog-update: $(CHLOGGEN)
242
259
.PHONY : generate-gh-issue-templates
243
260
generate-gh-issue-templates :
244
261
mkdir -p $(TOOLS_DIR ) /bin
245
- docker run --rm \
246
- -u $( id -u ${USER} ) : $( id -g ${USER} ) \
262
+ $( DOCKER_RUN ) --rm \
263
+ $( DOCKER_USER_IS_HOST_USER_ARG ) \
247
264
--mount ' type=bind,source=$(PWD)/internal/tools/scripts,target=/home/weaver/templates,readonly' \
248
265
--mount ' type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
249
266
--mount ' type=bind,source=$(TOOLS_DIR)/bin,target=/home/weaver/target' \
@@ -271,7 +288,7 @@ generate-gh-issue-templates:
271
288
LATEST_RELEASED_SEMCONV_VERSION := $(shell git ls-remote --tags https://github.com/open-telemetry/semantic-conventions.git | cut -f 2 | sort --reverse | head -n 1 | tr '/' ' ' | cut -d ' ' -f 3 | $(SED ) 's/v//g')
272
289
.PHONY : check-policies
273
290
check-policies :
274
- docker run --rm \
291
+ $( DOCKER_RUN ) --rm \
275
292
--mount ' type=bind,source=$(PWD)/policies,target=/home/weaver/policies,readonly' \
276
293
--mount ' type=bind,source=$(PWD)/model,target=/home/weaver/source,readonly' \
277
294
${WEAVER_CONTAINER} registry check \
@@ -282,7 +299,7 @@ check-policies:
282
299
# Test rego policies
283
300
.PHONY : test-policies
284
301
test-policies :
285
- docker run --rm -v $(PWD ) /policies:/policies -v $(PWD ) /policies_test:/policies_test \
302
+ $( DOCKER_RUN ) --rm -v $(PWD ) /policies:/policies -v $(PWD ) /policies_test:/policies_test \
286
303
${OPA_CONTAINER} test \
287
304
--var-values \
288
305
--explain fails \
@@ -293,5 +310,5 @@ test-policies:
293
310
# once github action requirements are updated.
294
311
.PHONY : compatibility-check
295
312
compatibility-check :
296
- docker run --rm -v $(PWD ) /model:/source -v $(PWD ) /docs:/spec --pull=always \
313
+ $( DOCKER_RUN ) --rm -v $(PWD ) /model:/source -v $(PWD ) /docs:/spec --pull=always \
297
314
$(SEMCONVGEN_CONTAINER ) --continue-on-validation-errors -f /source compatibility --previous-version $(LATEST_RELEASED_SEMCONV_VERSION )
0 commit comments