Skip to content

Commit

Permalink
Leverage az provider list (#3707)
Browse files Browse the repository at this point in the history
Fixes #2661

1. Add inactive default versions report - which versions referenced from
our default version are not currently marked as "live" by `az provider
list`?
2. When picking a new tracking version, select from the live versions
only, if any are live. Fall back to all versions if `az provider list`
doesn't include any.
3. When checking for additional resources not in the default version,
don't add new non-live versions.
4. Move most unit testing into gen_calculateVersionMetadata_test from
defaultVersion_test as it's as close to e2e as possible and requires
less mocking.
  • Loading branch information
danielrbradley authored Dec 2, 2024
2 parents 9b3e730 + 50c3df9 commit ee72d75
Show file tree
Hide file tree
Showing 12 changed files with 154,173 additions and 109,626 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ update_submodules:
echo "Updating submodule $$submodule" ; \
(cd $$submodule && git checkout main && git pull origin main); \
done
rm ./azure-provider-versions/provider_list.json
az provider list | jq 'map({ namespace: .namespace, resourceTypes: .resourceTypes | map({ resourceType: .resourceType, apiVersions: .apiVersions }) | sort_by(.resourceType) }) | sort_by(.namespace)' > ./azure-provider-versions/provider_list.json
rm versions/az-provider-list.json
# Use query option to remove all except specific fields and sort to reduce diff noise
az provider list --query 'sort_by([*].{ namespace: namespace, resourceTypes: sort_by(resourceTypes[*].{ resourceType: resourceType, defaultApiVersion: defaultApiVersion, apiVersions: apiVersions, locations: locations }, &resourceType) }, &namespace)' > versions/az-provider-list.json

# Use PROVIDER_TEST_TAGS=all to run all tests including examples integrate tests
PROVIDER_TEST_TAGS ?= unit # Default to unit tests only for quick local feedback
Expand Down Expand Up @@ -220,7 +221,7 @@ bin/$(CODEGEN): bin/pulumictl .make/prebuild .make/provider_mod_download provide

# Writes schema-full.json and metadata-compact.json to bin/
# Also re-calculates files in versions/ at same time
bin/schema-full.json bin/metadata-compact.json &: bin/$(CODEGEN) $(SPECS) azure-provider-versions/provider_list.json versions/v1-lock.json versions/v2-config.yaml versions/v2-spec.yaml versions/v2-removed-resources.json
bin/schema-full.json bin/metadata-compact.json &: bin/$(CODEGEN) $(SPECS) versions/az-provider-list.json versions/v1-lock.json versions/v2-config.yaml versions/v2-spec.yaml versions/v2-removed-resources.json
bin/$(CODEGEN) schema $(VERSION_GENERIC)

# Docs schema - treat as phony becasuse it's committed so we always need to rebuild it.
Expand Down
Loading

0 comments on commit ee72d75

Please sign in to comment.