Skip to content

Commit

Permalink
Fix generated CloudConfig type via Docker
Browse files Browse the repository at this point in the history
This patch fixes a weird issue when generate the Golang type(s) for
a Cloud-Init CloudConfig. When generating them via Docker, the
program quicktype used the schema's filename as part of the generated
types. This caused the file to look different when generated locally
versus when generated via a container.
  • Loading branch information
akutz committed Dec 18, 2023
1 parent f261a95 commit e4eb20b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/util/cloudinit/schema/Dockerfile.quicktype
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
FROM node:20 AS build
WORKDIR /quicktype

RUN npm install --prefix /quicktype quicktype

FROM gcr.io/distroless/nodejs20-debian12
COPY --from=build /quicktype /quicktype

WORKDIR /output
CMD [ \
"/quicktype/node_modules/quicktype/dist/index.js", \
"--src", "/schema.json", \
"--src", "/schema-cloud-config-v1.json", \
"--src-lang", "schema", \
"--out", "/output/cloudconfig.go", \
"--lang", "go", \
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/cloudinit/schema/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ifeq (docker,$(QUICKTYPE_METHOD))
$(CLOUD_CONFIG_GO): build-images-quicktype
docker run -it --rm \
-v $$(pwd):/output \
-v $$(pwd)/$(SCHEMA_CLOUD_CONFIG):/schema.json \
-v $$(pwd)/$(SCHEMA_CLOUD_CONFIG):/schema-cloud-config-v1.json \
$(QUICKTYPE_IMAGE)
$(GOIMPORTS) -w $@
else
Expand Down

0 comments on commit e4eb20b

Please sign in to comment.