From fb8a4456aa363e487f56cffc2de4cd1ec40fc5e4 Mon Sep 17 00:00:00 2001 From: Rachel Weber Date: Thu, 22 Jan 2026 14:14:45 -0800 Subject: [PATCH] Add option to pull data from config into json files --- .../testdata/zz_fixture_TestForEntrypoint.svg | 582 +++++++++--------- .../testdata/zz_fixture_TestForPipeline.svg | 118 ++-- pkg/types/pipeline.schema.v1.json | 20 + pkg/types/shell.go | 9 + .../zz_fixture_TestNewPipelineFromFile.yaml | 3 + testdata/pipeline.yaml | 3 + 6 files changed, 385 insertions(+), 350 deletions(-) diff --git a/pkg/graph/testdata/zz_fixture_TestForEntrypoint.svg b/pkg/graph/testdata/zz_fixture_TestForEntrypoint.svg index 302e59fc..772dc063 100644 --- a/pkg/graph/testdata/zz_fixture_TestForEntrypoint.svg +++ b/pkg/graph/testdata/zz_fixture_TestForEntrypoint.svg @@ -4,874 +4,874 @@ - + regexp - + Grandparent_global_acrs - -Grandparent/global/acrs + +Grandparent/global/acrs Grandparent_global_mirror-oc-mirror-image - -Grandparent/global/mirror-oc-mirror-image + +Grandparent/global/mirror-oc-mirror-image Grandparent_global_acrs->Grandparent_global_mirror-oc-mirror-image - - + + Grandparent_global_imagemirror - -Grandparent/global/imagemirror + +Grandparent/global/imagemirror Grandparent_global_mirror-oc-mirror-image->Grandparent_global_imagemirror - - + + Grandparent_global_certificates - -Grandparent/global/certificates + +Grandparent/global/certificates Parent_global_output - -Parent/global/output + +Parent/global/output Grandparent_global_certificates->Parent_global_output - - + + Uncle_global_output - -Uncle/global/output + +Uncle/global/output Grandparent_global_certificates->Uncle_global_output - - + + Parent_global_add-hcp-grafana-datasource - -Parent/global/add-hcp-grafana-datasource + +Parent/global/add-hcp-grafana-datasource Parent_global_output->Parent_global_add-hcp-grafana-datasource - - + + Parent_global_add-svc-grafana-datasource - -Parent/global/add-svc-grafana-datasource + +Parent/global/add-svc-grafana-datasource Parent_global_output->Parent_global_add-svc-grafana-datasource - - + + Parent_global_ocp-acr-replication - -Parent/global/ocp-acr-replication + +Parent/global/ocp-acr-replication Parent_global_output->Parent_global_ocp-acr-replication - - + + Parent_regional_rpRegistration - -Parent/regional/rpRegistration + +Parent/regional/rpRegistration Parent_global_output->Parent_regional_rpRegistration - - + + Parent_global_svc-acr-replication - -Parent/global/svc-acr-replication + +Parent/global/svc-acr-replication Parent_global_output->Parent_global_svc-acr-replication - - + + Parent_regional_region - -Parent/regional/region + +Parent/regional/region Parent_global_output->Parent_regional_region - - + + Sibling_management_mgmt-nsp - -Sibling/management/mgmt-nsp + +Sibling/management/mgmt-nsp Uncle_global_output->Sibling_management_mgmt-nsp - - + + Uncle_global_rg-ownership - -Uncle/global/rg-ownership + +Uncle/global/rg-ownership Uncle_global_output->Uncle_global_rg-ownership - - + + Uncle_regional_delete-region - -Uncle/regional/delete-region + +Uncle/regional/delete-region Uncle_global_output->Uncle_regional_delete-region - - + + Uncle_regional_rg-ownership - -Uncle/regional/rg-ownership + +Uncle/regional/rg-ownership Uncle_global_output->Uncle_regional_rg-ownership - - + + Grandparent_global_cxChildZone - -Grandparent/global/cxChildZone + +Grandparent/global/cxChildZone Grandparent_global_cxChildZone->Parent_global_output - - + + Grandparent_global_cxChildZone->Uncle_global_output - - + + Grandparent_global_decrypt-and-ingest-secrets - -Grandparent/global/decrypt-and-ingest-secrets + +Grandparent/global/decrypt-and-ingest-secrets Grandparent_global_decrypt-and-ingest-secrets->Grandparent_global_mirror-oc-mirror-image - - + + Grandparent_global_grafana-dashboards - -Grandparent/global/grafana-dashboards + +Grandparent/global/grafana-dashboards Grandparent_global_housekeeping - -Grandparent/global/housekeeping + +Grandparent/global/housekeeping Grandparent_global_housekeeping->Parent_global_output - - + + Grandparent_global_housekeeping->Uncle_global_output - - + + Grandparent_global_housekeeping->Grandparent_global_grafana-dashboards - - + + Grandparent_global_imagemirror->Parent_global_output - - + + Grandparent_global_imagemirror->Uncle_global_output - - + + Grandparent_global_infra - -Grandparent/global/infra + +Grandparent/global/infra Grandparent_global_infra->Grandparent_global_acrs - - + + Grandparent_global_infra->Grandparent_global_cxChildZone - - + + Grandparent_global_infra->Grandparent_global_decrypt-and-ingest-secrets - - + + Grandparent_global_infra->Grandparent_global_grafana-dashboards - - + + Grandparent_global_onecert-private-kv-issuer - -Grandparent/global/onecert-private-kv-issuer + +Grandparent/global/onecert-private-kv-issuer Grandparent_global_infra->Grandparent_global_onecert-private-kv-issuer - - + + Grandparent_global_output - -Grandparent/global/output + +Grandparent/global/output Grandparent_global_infra->Grandparent_global_output - - + + Grandparent_global_svcChildZone - -Grandparent/global/svcChildZone + +Grandparent/global/svcChildZone Grandparent_global_infra->Grandparent_global_svcChildZone - - + + Grandparent_global_onecert-private-kv-issuer->Grandparent_global_certificates - - + + Grandparent_global_output->Grandparent_global_mirror-oc-mirror-image - - + + Grandparent_global_output->Grandparent_global_decrypt-and-ingest-secrets - - + + Grandparent_global_output->Grandparent_global_grafana-dashboards - - + + Grandparent_global_output->Grandparent_global_housekeeping - - + + Grandparent_global_svcChildZone->Parent_global_output - - + + Grandparent_global_svcChildZone->Uncle_global_output - - + + Child_global_output - -Child/global/output + +Child/global/output Parent_global_add-hcp-grafana-datasource->Child_global_output - - + + Child_regional_output - -Child/regional/output + +Child/regional/output Parent_global_add-hcp-grafana-datasource->Child_regional_output - - + + Sibling_global_output - -Sibling/global/output + +Sibling/global/output Parent_global_add-hcp-grafana-datasource->Sibling_global_output - - + + Sibling_regional_output - -Sibling/regional/output + +Sibling/regional/output Parent_global_add-hcp-grafana-datasource->Sibling_regional_output - - + + Sibling_service_output - -Sibling/service/output + +Sibling/service/output Parent_global_add-hcp-grafana-datasource->Sibling_service_output - - + + Child_service_acrpull - -Child/service/acrpull + +Child/service/acrpull Child_global_output->Child_service_acrpull - - + + Child_service_arobit - -Child/service/arobit + +Child/service/arobit Child_global_output->Child_service_arobit - - + + Child_service_infra - -Child/service/infra + +Child/service/infra Child_global_output->Child_service_infra - - + + Child_service_istio-config - -Child/service/istio-config + +Child/service/istio-config Child_global_output->Child_service_istio-config - - + + Child_service_istio-upgrade - -Child/service/istio-upgrade + +Child/service/istio-upgrade Child_global_output->Child_service_istio-upgrade - - + + Child_service_prometheus - -Child/service/prometheus + +Child/service/prometheus Child_global_output->Child_service_prometheus - - + + Child_service_svc - -Child/service/svc + +Child/service/svc Child_global_output->Child_service_svc - - + + Child_regional_output->Child_service_infra - - + + Child_regional_output->Child_service_svc - - + + Sibling_management_acrpull - -Sibling/management/acrpull + +Sibling/management/acrpull Sibling_global_output->Sibling_management_acrpull - - + + Sibling_management_arobit - -Sibling/management/arobit + +Sibling/management/arobit Sibling_global_output->Sibling_management_arobit - - + + Sibling_management_mgmt-cluster - -Sibling/management/mgmt-cluster + +Sibling/management/mgmt-cluster Sibling_global_output->Sibling_management_mgmt-cluster - - + + Sibling_management_mgmt-fixes - -Sibling/management/mgmt-fixes + +Sibling/management/mgmt-fixes Sibling_global_output->Sibling_management_mgmt-fixes - - + + Sibling_management_mgmt-infra - -Sibling/management/mgmt-infra + +Sibling/management/mgmt-infra Sibling_global_output->Sibling_management_mgmt-infra - - + + Sibling_management_prometheus - -Sibling/management/prometheus + +Sibling/management/prometheus Sibling_global_output->Sibling_management_prometheus - - + + Sibling_management_rpRegistration - -Sibling/management/rpRegistration + +Sibling/management/rpRegistration Sibling_global_output->Sibling_management_rpRegistration - - + + Sibling_regional_output->Sibling_management_mgmt-cluster - - + + Sibling_regional_output->Sibling_management_mgmt-infra - - + + Sibling_service_output->Sibling_management_mgmt-infra - - + + Sibling_service_output->Sibling_management_mgmt-nsp - - + + Parent_global_add-svc-grafana-datasource->Parent_global_add-hcp-grafana-datasource - - + + Parent_global_ocp-acr-replication->Parent_regional_rpRegistration - - + + Parent_regional_rpRegistration->Parent_regional_region - - + + Parent_global_svc-acr-replication->Parent_regional_rpRegistration - - + + Parent_regional_output - -Parent/regional/output + +Parent/regional/output Parent_regional_region->Parent_regional_output - - + + Parent_regional_output->Parent_global_add-hcp-grafana-datasource - - + + Parent_regional_output->Parent_global_add-svc-grafana-datasource - - + + Child_service_svc-oncert-private-kv-issuer - -Child/service/svc-oncert-private-kv-issuer + +Child/service/svc-oncert-private-kv-issuer Child_service_infra->Child_service_svc-oncert-private-kv-issuer - - + + Child_service_svc-oncert-public-kv-issuer - -Child/service/svc-oncert-public-kv-issuer + +Child/service/svc-oncert-public-kv-issuer Child_service_infra->Child_service_svc-oncert-public-kv-issuer - - + + Child_service_istio-config->Child_service_istio-upgrade - - + + Child_service_prometheus->Child_service_acrpull - - + + Child_service_prometheus->Child_service_istio-config - - + + Child_service_svc->Child_service_arobit - - + + Child_service_svc->Child_service_prometheus - - + + Child_service_svc-oncert-private-kv-issuer->Child_service_svc - - + + Child_service_svc-oncert-public-kv-issuer->Child_service_svc - - + + Sibling_management_mgmt-cluster->Sibling_management_arobit - - + + Sibling_management_mgmt-cluster->Sibling_management_mgmt-fixes - - + + Sibling_management_mgmt-cluster->Sibling_management_prometheus - - + + Sibling_management_mgmt-cluster->Sibling_management_mgmt-nsp - - + + Sibling_management_cx-oncert-public-kv-issuer - -Sibling/management/cx-oncert-public-kv-issuer + +Sibling/management/cx-oncert-public-kv-issuer Sibling_management_mgmt-infra->Sibling_management_cx-oncert-public-kv-issuer - - + + Sibling_management_mgmt-infra->Sibling_management_mgmt-nsp - - + + Sibling_management_mgmt-oncert-private-kv-issuer - -Sibling/management/mgmt-oncert-private-kv-issuer + +Sibling/management/mgmt-oncert-private-kv-issuer Sibling_management_mgmt-infra->Sibling_management_mgmt-oncert-private-kv-issuer - - + + Sibling_management_mgmt-oncert-public-kv-issuer - -Sibling/management/mgmt-oncert-public-kv-issuer + +Sibling/management/mgmt-oncert-public-kv-issuer Sibling_management_mgmt-infra->Sibling_management_mgmt-oncert-public-kv-issuer - - + + Sibling_management_prometheus->Sibling_management_acrpull - - + + Sibling_management_rpRegistration->Sibling_management_mgmt-infra - - + + Sibling_management_cx-oncert-public-kv-issuer->Sibling_management_mgmt-cluster - - + + Sibling_management_mgmt-oncert-private-kv-issuer->Sibling_management_mgmt-cluster - - + + Sibling_management_mgmt-oncert-public-kv-issuer->Sibling_management_mgmt-cluster - - + + Uncle_global_rg-ownership->Uncle_regional_delete-region - - + + Uncle_regional_rg-ownership->Uncle_regional_delete-region - - + + serviceValidation - -serviceValidation + +serviceValidation Child_service_validation - -Child_service_validation + +Child_service_validation serviceValidation->Child_service_validation - - + + diff --git a/pkg/graph/testdata/zz_fixture_TestForPipeline.svg b/pkg/graph/testdata/zz_fixture_TestForPipeline.svg index e29c9867..72d46cf8 100644 --- a/pkg/graph/testdata/zz_fixture_TestForPipeline.svg +++ b/pkg/graph/testdata/zz_fixture_TestForPipeline.svg @@ -4,178 +4,178 @@ - + regexp - + Grandparent_global_acrs - -Grandparent/global/acrs + +Grandparent/global/acrs Grandparent_global_mirror-oc-mirror-image - -Grandparent/global/mirror-oc-mirror-image + +Grandparent/global/mirror-oc-mirror-image Grandparent_global_acrs->Grandparent_global_mirror-oc-mirror-image - - + + Grandparent_global_imagemirror - -Grandparent/global/imagemirror + +Grandparent/global/imagemirror Grandparent_global_mirror-oc-mirror-image->Grandparent_global_imagemirror - - + + Grandparent_global_certificates - -Grandparent/global/certificates + +Grandparent/global/certificates Grandparent_global_cxChildZone - -Grandparent/global/cxChildZone + +Grandparent/global/cxChildZone Grandparent_global_decrypt-and-ingest-secrets - -Grandparent/global/decrypt-and-ingest-secrets + +Grandparent/global/decrypt-and-ingest-secrets Grandparent_global_decrypt-and-ingest-secrets->Grandparent_global_mirror-oc-mirror-image - - + + Grandparent_global_grafana-dashboards - -Grandparent/global/grafana-dashboards + +Grandparent/global/grafana-dashboards Grandparent_global_housekeeping - -Grandparent/global/housekeeping + +Grandparent/global/housekeeping Grandparent_global_housekeeping->Grandparent_global_grafana-dashboards - - + + Grandparent_global_infra - -Grandparent/global/infra + +Grandparent/global/infra Grandparent_global_infra->Grandparent_global_acrs - - + + Grandparent_global_infra->Grandparent_global_cxChildZone - - + + Grandparent_global_infra->Grandparent_global_decrypt-and-ingest-secrets - - + + Grandparent_global_infra->Grandparent_global_grafana-dashboards - - + + Grandparent_global_onecert-private-kv-issuer - -Grandparent/global/onecert-private-kv-issuer + +Grandparent/global/onecert-private-kv-issuer Grandparent_global_infra->Grandparent_global_onecert-private-kv-issuer - - + + Grandparent_global_output - -Grandparent/global/output + +Grandparent/global/output Grandparent_global_infra->Grandparent_global_output - - + + Grandparent_global_svcChildZone - -Grandparent/global/svcChildZone + +Grandparent/global/svcChildZone Grandparent_global_infra->Grandparent_global_svcChildZone - - + + Grandparent_global_onecert-private-kv-issuer->Grandparent_global_certificates - - + + Grandparent_global_output->Grandparent_global_mirror-oc-mirror-image - - + + Grandparent_global_output->Grandparent_global_decrypt-and-ingest-secrets - - + + Grandparent_global_output->Grandparent_global_grafana-dashboards - - + + Grandparent_global_output->Grandparent_global_housekeeping - - + + diff --git a/pkg/types/pipeline.schema.v1.json b/pkg/types/pipeline.schema.v1.json index 4cf26315..b123f7c8 100644 --- a/pkg/types/pipeline.schema.v1.json +++ b/pkg/types/pipeline.schema.v1.json @@ -298,6 +298,20 @@ } } }, + "jsonConfigReference": { + "properties": { + "configPath": { + "type": "string" + }, + "destinationFilePath": { + "type": "string" + } + }, + "required": [ + "configPath", + "destinationFilePath" + ] + }, "armStep": { "unevaluatedProperties": false, "allOf": [ @@ -444,6 +458,12 @@ "items": { "$ref": "#/definitions/adoArtifactDownloadReference" } + }, + "jsonsFromConfig": { + "type": "array", + "items": { + "$ref": "#/definitions/jsonConfigReference" + } } }, "required": [ diff --git a/pkg/types/shell.go b/pkg/types/shell.go index e3d8ef0a..3f027128 100644 --- a/pkg/types/shell.go +++ b/pkg/types/shell.go @@ -40,6 +40,8 @@ type ShellStep struct { ShellIdentity Value `json:"shellIdentity"` // AdoArtifacts is a list of Azure DevOps artifacts to download before executing the shell step. AdoArtifacts []AdoArtifactDownloadPipelineReference `json:"adoArtifacts,omitempty"` + // JsonsFromConfig is a json files to be created from config content before executing the shell step. + JsonsFromConfig []ConfigFileReference `json:"jsonsFromConfig,omitempty"` } // Reference represents a configurable reference @@ -60,6 +62,13 @@ type AdoArtifactDownloadPipelineReference struct { FileSourceToDestination map[string]string `json:"fileSourceToDestination,omitempty"` } +type ConfigFileReference struct { + // configPath is the config path with the content to be placed in the destination file. + ConfigPath string `json:"configPath,omitempty"` + // DestinationFilePath is the file path where the config content will be placed. + DestinationFilePath string `json:"destinationFilePath,omitempty"` +} + // Description // Returns: // - A string representation of this ShellStep diff --git a/pkg/types/testdata/zz_fixture_TestNewPipelineFromFile.yaml b/pkg/types/testdata/zz_fixture_TestNewPipelineFromFile.yaml index dc8593a6..fcfdda75 100644 --- a/pkg/types/testdata/zz_fixture_TestNewPipelineFromFile.yaml +++ b/pkg/types/testdata/zz_fixture_TestNewPipelineFromFile.yaml @@ -32,6 +32,9 @@ resourceGroups: aksCluster: aro-hcp-aks command: make deploy dryRun: {} + jsonsFromConfig: + - configPath: configuration.path.to.segment + destinationFilePath: config-segment.json name: deploy shellIdentity: configRef: aroDevopsMsiId diff --git a/testdata/pipeline.yaml b/testdata/pipeline.yaml index a899febb..3956bd00 100644 --- a/testdata/pipeline.yaml +++ b/testdata/pipeline.yaml @@ -48,6 +48,9 @@ resourceGroups: buildId: '{{ .imageMirror.buildId }}' fileSourceToDestination: 'path/in/artifact/file1.txt': 'local/path/file1.txt' + jsonsFromConfig: + - destinationFilePath: config-segment.json + configPath: configuration.path.to.segment - name: dry-run action: Shell command: make deploy