Skip to content

Commit

Permalink
Integrate into pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
theunrepentantgeek committed Jul 5, 2021
1 parent 31bcba6 commit 746553c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions hack/generator/pkg/codegen/code_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func createAllPipelineStages(idFactory astmodel.IdentifierFactory, configuration
pipeline.InjectJsonSerializationTests(idFactory).UsedFor(pipeline.ARMTarget),

pipeline.MarkStorageVersion(),
pipeline.InjectHubFunction(idFactory).UsedFor(pipeline.ARMTarget),

// Safety checks at the end:
pipeline.EnsureDefinitionsDoNotUseAnyTypes(),
Expand Down
1 change: 1 addition & 0 deletions hack/generator/pkg/codegen/golden_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func NewTestCodeGenerator(testName string, path string, t *testing.T, testConfig
"injectOriginalVersionFunction",
"injectOriginalVersionProperty",
"injectPropertyAssignmentFunctions",
pipeline.InjectHubFunctionStageId,
"reportTypesAndVersions")
if !testConfig.HasARMResources {
codegen.RemoveStages("createArmTypes", "applyArmConversionInterface")
Expand Down
5 changes: 4 additions & 1 deletion hack/generator/pkg/codegen/pipeline/mark_storage_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ import (
"github.com/Azure/azure-service-operator/hack/generator/pkg/astmodel"
)

// MarkStorageVersionStageId is the unique identifier for this pipeline stage
const MarkStorageVersionStageId = "markStorageVersion"

// MarkStorageVersion creates a Stage to mark a particular version as a storage version
func MarkStorageVersion() Stage {
return MakeStage(
"markStorageVersion",
MarkStorageVersionStageId,
"Mark the latest version of each resource as the storage version",
func(ctx context.Context, types astmodel.Types) (astmodel.Types, error) {
updatedDefs, err := MarkLatestResourceVersionsForStorage(types)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ injectOriginalGVKFunction azure Inject the function OriginalGVK()
simplifyDefinitions Flatten definitions by removing wrapper types
jsonTestCases azure Add test cases to verify JSON serialization
markStorageVersion Mark the latest version of each resource as the storage version
injectHubFunction azure Inject the function Hub() into each hub resource
rogueCheck Check for rogue definitions using AnyTypes
ensureArmTypeExistsForEveryType azure Check that an ARM type exists for both Spec and Status of each resource
deleteGenerated Delete generated code from .
Expand Down

0 comments on commit 746553c

Please sign in to comment.