`make codegen` does not succeed on master (for me)
Summary
I do not believe that this is actually a "bug" or regression, but I'm labelling as such because it's incorrect behavior on a fresh branch. Depending on the cause, there might be a way to improve the repo so that others don't spend as much time debugging as I have.
I am trying to run make codegen on commit b0c1df6 (I have encountered this on other commits). I'm developing in a devcontainer using the provided configuration.
When running this command, I would expect no errors to occur, and no new files to be generated. Instead, I receive errors and many files end up being deleted, specifically from ./sdks.
Details
Here's what I see when I run make generate from within ./sdks/java:
rm -Rf /Users/robertkotcher/go/src/github.com/argoproj/argo-workflows/sdks/java/client
mkdir -p /Users/robertkotcher/go/src/github.com/argoproj/argo-workflows/sdks/java/client
cp settings.xml /Users/robertkotcher/go/src/github.com/argoproj/argo-workflows/sdks/java/client/settings.xml
cat ../../api/openapi-spec/swagger.json | \
sed 's/io.k8s.api.core.v1.//' | \
sed 's/io.k8s.apimachinery.pkg.apis.meta.v1.//' \
> /Users/robertkotcher/go/src/github.com/argoproj/argo-workflows/sdks/java/client/swagger.json
docker run --rm -v /Users/robertkotcher/go/src/github.com/argoproj/argo-workflows/sdks/java/client:/wd --workdir /wd openapitools/openapi-generator-cli:v5.2.1 \
generate \
-i /wd/swagger.json \
-g java \
-o /wd \
-p hideGenerationTimestamp=true \
-p serializationLibrary=jsonb \
-p dateLibrary=java8 \
--api-package io.argoproj.workflow.apis \
--invoker-package io.argoproj.workflow \
--model-package io.argoproj.workflow.models \
--skip-validate-spec \
--group-id io.argoproj.workflow \
--artifact-id argo-client-java \
--artifact-version 0.0.0-SNAPSHOT \
--import-mappings Time=java.time.Instant \
--import-mappings Affinity=io.kubernetes.client.openapi.models.V1Affinity \
--import-mappings ConfigMapKeySelector=io.kubernetes.client.openapi.models.V1ConfigMapKeySelector \
--import-mappings Container=io.kubernetes.client.openapi.models.V1Container \
--import-mappings ContainerPort=io.kubernetes.client.openapi.models.V1ContainerPort \
--import-mappings EnvFromSource=io.kubernetes.client.openapi.models.V1EnvFromSource \
--import-mappings EnvVar=io.kubernetes.client.openapi.models.V1EnvVar \
--import-mappings HostAlias=io.kubernetes.client.openapi.models.V1HostAlias \
--import-mappings Lifecycle=io.kubernetes.client.openapi.models.V1Lifecycle \
--import-mappings ListMeta=io.kubernetes.client.openapi.models.V1ListMeta \
--import-mappings LocalObjectReference=io.kubernetes.client.openapi.models.V1LocalObjectReference \
--import-mappings ObjectMeta=io.kubernetes.client.openapi.models.V1ObjectMeta \
--import-mappings ObjectReference=io.kubernetes.client.openapi.models.V1ObjectReference \
--import-mappings PersistentVolumeClaim=io.kubernetes.client.openapi.models.V1PersistentVolumeClaim \
--import-mappings PodDisruptionBudgetSpec=io.kubernetes.client.openapi.models.V1beta1PodDisruptionBudgetSpec \
--import-mappings PodDNSConfig=io.kubernetes.client.openapi.models.V1PodDNSConfig \
--import-mappings PodSecurityContext=io.kubernetes.client.openapi.models.V1PodSecurityContext \
--import-mappings Probe=io.kubernetes.client.openapi.models.V1Probe \
--import-mappings ResourceRequirements=io.kubernetes.client.openapi.models.V1ResourceRequirements \
--import-mappings SecretKeySelector=io.kubernetes.client.openapi.models.V1SecretKeySelector \
--import-mappings SecurityContext=io.kubernetes.client.openapi.models.V1SecurityContext \
--import-mappings Toleration=io.kubernetes.client.openapi.models.V1Toleration \
--import-mappings Volume=io.kubernetes.client.openapi.models.V1Volume \
--import-mappings VolumeDevice=io.kubernetes.client.openapi.models.V1VolumeDevice \
--import-mappings VolumeMount=io.kubernetes.client.openapi.models.V1VolumeMount \
--generate-alias-as-model
[error] The spec file is not found: /wd/swagger.json
[error] Check the path of the OpenAPI spec and try again.
I have narrowed down the issue. What I'm finding is that there are issues when running make generate for both ./sdks/java and ./sdks/python. It seems as if DOCKER = docker run --rm -v $(WD):/wd --workdir /wd (defined in both Makefiles) is not mounting $WD properly, so inside the container /wd is empty.
Sure enough, if I run:
docker run --rm -v /Users/<USERNAME>/go/src/github.com/argoproj/argo-workflows/sdks/java/client:/wd --workdir /wd openapitools/openapi-generator-cli:v5.2.1 ls
I'm finding that the directory is empty.
Conclusion
I will continue to hunt for the issue here - It's very likely something is configured wrong for me locally. But depending on the issue, perhaps there's something that can be added to help save time for the next person who runs across this.
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
Try running make pre-commit in the project root.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.
I'm running into this same issue when running make pre-commit -B. Running make pre-commit did not help. Were you able to find a solution? Thanks!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.
I can't reproduce this in the current devcontainer (which I use quite frequently), so going to close this out as no longer an issue.