Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: support deploytargets and logs2webhooks in exports #255

Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions internal/lagoon/client/_lgraphql/projectByName.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ query (
autoIdle
factsUi
problemsUi
deployTargetConfigs {
branches
deployTarget{
id
name
token
}
id
project{
autoIdle
gitUrl
name
productionEnvironment
storageCalc
}
pullrequests
weight
}
groups{
... on Group {
__typename
Expand Down
358 changes: 194 additions & 164 deletions internal/lagoon/client/lgraphql/lgraphql.go

Large diffs are not rendered by default.

183 changes: 92 additions & 91 deletions internal/mock/mock_importer.go

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions internal/mock/mock_me.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added internal/schema/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions internal/schema/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func ProjectsToConfig(
for _, project := range projects {
projectConfig :=
ProjectConfig{Project: project, Notifications: &ProjectNotifications{}}

for _, group := range project.Groups.Groups {
// project group users are appended to the project directly because this
// group is automatically created in Lagoon.
Expand Down Expand Up @@ -197,6 +198,7 @@ func ProjectsToConfig(
config.Notifications.MicrosoftTeams =
append(config.Notifications.MicrosoftTeams, n)
}

minimiseProjectConfig(&projectConfig, exclude)
config.Projects = append(config.Projects, projectConfig)
}
Expand Down
12 changes: 6 additions & 6 deletions internal/schema/deploytargetconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package schema
// DeployTargetConfig .
type DeployTargetConfig struct {
ID uint `json:"id"`
Project Project `json:"project"`
Weight uint `json:"weight"`
Branches string `json:"branches"`
Pullrequests string `json:"pullrequests"`
DeployTarget DeployTarget `json:"deployTarget"`
DeployTargetProjectPattern string `json:"deployTargetProjectPattern"`
Project Project `json:"project,omitempty"`
Weight uint `json:"weight,omitempty"`
Branches string `json:"branches,omitempty"`
Pullrequests string `json:"pullrequests,omitempty"`
DeployTarget DeployTarget `json:"deployTarget,omitempty"`
DeployTargetProjectPattern string `json:"deployTargetProjectPattern,omitempty"`
}

// AddDeployTargetConfigInput .
Expand Down
3 changes: 2 additions & 1 deletion internal/schema/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type Project struct {
// Openshift is unmarshalled during export.
OpenshiftID *OpenshiftID `json:"openshift,omitempty"`
// Groups are unmarshalled during export.
Groups *Groups `json:"groups,omitempty"`
Groups *Groups `json:"groups,omitempty"`
DeployTargetConfig []DeployTargetConfig `json:"deployTargetConfigs,omitempty"`
}

// ProjectConfig contains project configuration.
Expand Down
15 changes: 15 additions & 0 deletions internal/schema/testdata/ciBranchPicky.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ groups:
projects:
- autoIdle: 1
branches: ^feature/|^(dev|test|develop|master)$
deployTargetConfigs:
- branches: qa
deployTarget:
id: 157
name: test.amazee.io
token: test
id: 2094
project:
autoIdle: 1
gitUrl: ssh://[email protected]:7999/wpsites/test.git
name: test-template
productionEnvironment: master
storageCalc: 1
pullrequests: "false"
weight: 102
environments:
- autoIdle: 1
deployBaseRef: master
Expand Down
303 changes: 154 additions & 149 deletions internal/schema/testdata/ciBranchPicky.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions internal/schema/testdata/newNotifications.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ notifications:
webhook: https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn
projects:
- autoIdle: 1
deployTargetConfigs:
- branches: qa
deployTarget:
id: 157
name: test.amazee.io
token: test
id: 1245
project:
autoIdle: 1
gitUrl: ssh://[email protected]:888/wpsites/test.git
name: test-template
productionEnvironment: master
storageCalc: 1
environments:
- autoIdle: 1
deployBaseRef: master
Expand Down
Loading