Skip to content

Commit

Permalink
cmd: rename fields in azure snapshot payload. update azure snapshots …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
arstanaly committed Dec 12, 2023
1 parent c281356 commit 80c39f9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions cmd/kosli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ The service principal needs to have the following permissions:
azureTenantIdFlag = "Azure tenant ID."
azureSubscriptionIdFlag = "Azure subscription ID."
azureResourceGroupNameFlag = "Azure resource group name."
azureDigestsSourceFlag = "[defaulted] Where to get the digests from. Valid values are 'acr' and 'logs'. Defaults to 'acr'"
githubTokenFlag = "Github token."
githubOrgFlag = "Github organization. (defaulted if you are running in GitHub Actions: https://docs.kosli.com/ci-defaults )."
githubBaseURLFlag = "[optional] GitHub base URL (only needed for GitHub Enterprise installations)."
Expand Down
2 changes: 1 addition & 1 deletion cmd/kosli/snapshotAzureApps.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func newSnapshotAzureAppsCmd(out io.Writer) *cobra.Command {
cmd.Flags().StringVar(&o.azureStaticCredentials.SubscriptionId, "azure-subscription-id", "", azureSubscriptionIdFlag)
cmd.Flags().StringVar(&o.azureStaticCredentials.ResourceGroupName, "azure-resource-group-name", "", azureResourceGroupNameFlag)
cmd.Flags().BoolVar(&o.azureStaticCredentials.DownloadLogsAsZip, "zip", false, "Download logs from Azure as zip files")
cmd.Flags().StringVar(&o.azureStaticCredentials.DigestsSource, "digests-source", "acr", "[defaulted] Where to get the digests from. Valid values are 'acr' and 'logs'. Defaults to 'acr'")
cmd.Flags().StringVar(&o.azureStaticCredentials.DigestsSource, "digests-source", "acr", azureDigestsSourceFlag)
addDryRunFlag(cmd)

err := RequireFlags(cmd, []string{
Expand Down
6 changes: 3 additions & 3 deletions cmd/kosli/snapshotAzureApps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ func (suite *SnapshotAzureAppsTestSuite) TestSnapshotAzureAppsCmd() {
},
{
name: "snapshot azure succeeds if all required flags are set",
cmd: fmt.Sprintf(`snapshot azure %s %s %s --dry-run`, suite.envName, suite.defaultKosliArguments, suite.defaultAzureArguments),
cmd: fmt.Sprintf(`snapshot azure %s %s %s`, suite.envName, suite.defaultKosliArguments, suite.defaultAzureArguments),
},
{
name: "snapshot azure succeeds when digests-source is set to acr if all required flags are set",
cmd: fmt.Sprintf(`snapshot azure %s %s %s --digests-source acr --dry-run`, suite.envName, suite.defaultKosliArguments, suite.defaultAzureArguments),
cmd: fmt.Sprintf(`snapshot azure %s %s %s --digests-source acr`, suite.envName, suite.defaultKosliArguments, suite.defaultAzureArguments),
},
{
name: "snapshot azure succeeds when digests-source is set to logs if all required flags are set",
cmd: fmt.Sprintf(`snapshot azure %s %s %s --digests-source logs --dry-run`, suite.envName, suite.defaultKosliArguments, suite.defaultAzureArguments),
cmd: fmt.Sprintf(`snapshot azure %s %s %s --digests-source logs`, suite.envName, suite.defaultKosliArguments, suite.defaultAzureArguments),
},

{
Expand Down
6 changes: 3 additions & 3 deletions internal/azure/azure_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ type AzureClient struct {

// AppData represents the harvested Azure service app and function app data
type AppData struct {
AppName string `json:"appName"`
AppKind string `json:"appKind"`
DigestsSource string `json:"digestsSource"`
AppName string `json:"app_name"`
AppKind string `json:"app_kind"`
DigestsSource string `json:"digests_source"`
Digests map[string]string `json:"digests"`
StartedAt int64 `json:"creationTimestamp"`
}
Expand Down

0 comments on commit 80c39f9

Please sign in to comment.