-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1835 from keboola/petr-hosek-PSGO-664
CLI: Fix ignoring branch name for diff
- Loading branch information
Showing
44 changed files
with
269 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
package create | ||
|
||
import ( | ||
"context" | ||
// type Options struct { | ||
// Objects model.ObjectStates | ||
//} | ||
// | ||
// type dependencies interface { | ||
// Telemetry() telemetry.Telemetry | ||
//} | ||
|
||
"github.com/keboola/keboola-as-code/internal/pkg/diff" | ||
"github.com/keboola/keboola-as-code/internal/pkg/model" | ||
"github.com/keboola/keboola-as-code/internal/pkg/telemetry" | ||
) | ||
|
||
type Options struct { | ||
Objects model.ObjectStates | ||
} | ||
|
||
type dependencies interface { | ||
Telemetry() telemetry.Telemetry | ||
} | ||
|
||
func Run(ctx context.Context, o Options, d dependencies) (results *diff.Results, err error) { | ||
ctx, span := d.Telemetry().Tracer().Start(ctx, "keboola.go.operation.template.sync.diff.create") | ||
defer span.End(&err) | ||
|
||
differ := diff.NewDiffer(o.Objects) | ||
results, err = differ.Diff() | ||
if err != nil { | ||
return nil, err | ||
} | ||
return results, nil | ||
} | ||
// func Run(ctx context.Context, o Options, d dependencies) (results *diff.Results, err error) { | ||
// ctx, span := d.Telemetry().Tracer().Start(ctx, "keboola.go.operation.template.sync.diff.create") | ||
// defer span.End(&err) | ||
// | ||
// differ := diff.NewDiffer(o.Objects) | ||
// results, err = differ.Diff() | ||
// if err != nil { | ||
// return nil, err | ||
// } | ||
// return results, nil | ||
//} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
push --storage-api-token %%TEST_KBC_STORAGE_API_TOKEN%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
KBC_PROJECT_ID=%%TEST_KBC_PROJECT_ID%% | ||
KBC_BRANCH_ID=%%TEST_BRANCH_MAIN_ID%% |
1 change: 1 addition & 0 deletions
1
test/cli/allow-target-env/push-changed-config-values/expected-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
32 changes: 32 additions & 0 deletions
32
test/cli/allow-target-env/push-changed-config-values/expected-state.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"branches": [ | ||
{ | ||
"branch": { | ||
"name": "Main", | ||
"description": "", | ||
"isDefault": true | ||
}, | ||
"configs": [ | ||
{ | ||
"componentId": "keboola.data-apps", | ||
"name": "Data-App", | ||
"description": "test fixture", | ||
"changeDescription": "Updated from #KeboolaCLI", | ||
"configuration": { | ||
"foo": "modified" | ||
}, | ||
"rows": [], | ||
"isDisabled": false | ||
}, | ||
{ | ||
"componentId": "ex-generic-v2", | ||
"name": "empty", | ||
"description": "test fixture", | ||
"configuration": {}, | ||
"rows": [], | ||
"isDisabled": false | ||
} | ||
] | ||
} | ||
] | ||
} |
Empty file.
7 changes: 7 additions & 0 deletions
7
test/cli/allow-target-env/push-changed-config-values/expected-stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Overriding the project ID by the environment variable KBC_PROJECT_ID=%s | ||
Overriding the branch ID by the environment variable KBC_BRANCH_ID=%s | ||
Plan for "push" operation: | ||
* C main/app/keboola.data-apps/data-app | changed: configuration, name | ||
× C main/extractor/ex-generic-v2/empty - SKIPPED | ||
Skipped remote objects deletion, use "--force" to delete them. | ||
Push done. |
49 changes: 49 additions & 0 deletions
49
test/cli/allow-target-env/push-changed-config-values/in/.keboola/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"version": 2, | ||
"project": { | ||
"id": 1, | ||
"apiHost": "%%TEST_KBC_STORAGE_API_HOST%%" | ||
}, | ||
"allowTargetEnv": true, | ||
"sortBy": "path", | ||
"naming": { | ||
"branch": "{branch_name}", | ||
"config": "{component_type}/{component_id}/{config_name}", | ||
"configRow": "rows/{config_row_name}", | ||
"schedulerConfig": "schedules/{config_name}", | ||
"sharedCodeConfig": "_shared/{target_component_id}", | ||
"sharedCodeConfigRow": "codes/{config_row_name}", | ||
"variablesConfig": "variables", | ||
"variablesValuesRow": "values/{config_row_name}", | ||
"dataAppConfig": "app/{component_id}/{config_name}" | ||
}, | ||
"allowedBranches": [ | ||
"2" | ||
], | ||
"ignoredComponents": [], | ||
"templates": { | ||
"repositories": [ | ||
{ | ||
"type": "git", | ||
"name": "keboola", | ||
"url": "https://github.com/keboola/keboola-as-code-templates.git", | ||
"ref": "main" | ||
} | ||
] | ||
}, | ||
"branches": [ | ||
{ | ||
"id": 2, | ||
"path": "main" | ||
} | ||
], | ||
"configurations": [ | ||
{ | ||
"branchId": 2, | ||
"componentId": "keboola.data-apps", | ||
"id": "%%TEST_BRANCH_MAIN_CONFIG_DATA_APP_ID%%", | ||
"path": "app/keboola.data-apps/data-app", | ||
"rows": [] | ||
} | ||
] | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
...-target-env/push-changed-config-values/in/main/app/keboola.data-apps/data-app/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"foo": "modified" | ||
} |
1 change: 1 addition & 0 deletions
1
...ush-changed-config-values/in/main/app/keboola.data-apps/data-app/description.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test fixture |
4 changes: 4 additions & 0 deletions
4
...ow-target-env/push-changed-config-values/in/main/app/keboola.data-apps/data-app/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "Data-App", | ||
"isDisabled": false | ||
} |
Empty file.
4 changes: 4 additions & 0 deletions
4
test/cli/allow-target-env/push-changed-config-values/in/main/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "Main", | ||
"isDefault": true | ||
} |
Oops, something went wrong.