diff --git a/api/repo/create.go b/api/repo/create.go index 9fe69dfad..59ccbf857 100644 --- a/api/repo/create.go +++ b/api/repo/create.go @@ -182,34 +182,6 @@ func CreateRepo(c *gin.Context) { r.SetAllowEvents(defaultAllowedEvents(defaultRepoEvents, defaultRepoEventsMask)) } - // -- DEPRECATED SECTION -- - // set default events if no events are passed in - if !input.GetAllowPull() && !input.GetAllowPush() && - !input.GetAllowDeploy() && !input.GetAllowTag() && - !input.GetAllowComment() { - for _, event := range defaultRepoEvents { - switch event { - case constants.EventPull: - r.SetAllowPull(true) - case constants.EventPush: - r.SetAllowPush(true) - case constants.EventDeploy: - r.SetAllowDeploy(true) - case constants.EventTag: - r.SetAllowTag(true) - case constants.EventComment: - r.SetAllowComment(true) - } - } - } else { - r.SetAllowComment(input.GetAllowComment()) - r.SetAllowDeploy(input.GetAllowDeploy()) - r.SetAllowPull(input.GetAllowPull()) - r.SetAllowPush(input.GetAllowPush()) - r.SetAllowTag(input.GetAllowTag()) - } - // -- END DEPRECATED SECTION -- - if len(input.GetPipelineType()) == 0 { r.SetPipelineType(constants.PipelineTypeYAML) } else { @@ -275,11 +247,7 @@ func CreateRepo(c *gin.Context) { // make sure our record of the repo allowed events matches what we send to SCM // what the dbRepo has should override default events on enable - r.SetAllowComment(dbRepo.GetAllowComment()) - r.SetAllowDeploy(dbRepo.GetAllowDeploy()) - r.SetAllowPull(dbRepo.GetAllowPull()) - r.SetAllowPush(dbRepo.GetAllowPush()) - r.SetAllowTag(dbRepo.GetAllowTag()) + r.SetAllowEvents(dbRepo.GetAllowEvents()) } // check if we should create the webhook diff --git a/api/repo/update.go b/api/repo/update.go index ba21996d3..efdb1a366 100644 --- a/api/repo/update.go +++ b/api/repo/update.go @@ -191,51 +191,6 @@ func UpdateRepo(c *gin.Context) { eventsChanged = true } - // -- DEPRECATED SECTION -- - if input.AllowPull != nil { - // update allow_pull if set - r.SetAllowPull(input.GetAllowPull()) - - eventsChanged = true - } - - if input.AllowPush != nil { - // update allow_push if set - r.SetAllowPush(input.GetAllowPush()) - - eventsChanged = true - } - - if input.AllowDeploy != nil { - // update allow_deploy if set - r.SetAllowDeploy(input.GetAllowDeploy()) - - eventsChanged = true - } - - if input.AllowTag != nil { - // update allow_tag if set - r.SetAllowTag(input.GetAllowTag()) - - eventsChanged = true - } - - if input.AllowComment != nil { - // update allow_comment if set - r.SetAllowComment(input.GetAllowComment()) - - eventsChanged = true - } - - // set default events if no events are enabled - if !r.GetAllowPull() && !r.GetAllowPush() && - !r.GetAllowDeploy() && !r.GetAllowTag() && - !r.GetAllowComment() { - r.SetAllowPull(true) - r.SetAllowPush(true) - } - // -- END DEPRECATED SECTION -- - // set default events if no events are enabled if r.GetAllowEvents().ToDatabase() == 0 { r.SetAllowEvents(defaultAllowedEvents(defaultRepoEvents, defaultRepoEventsMask)) diff --git a/api/secret/create.go b/api/secret/create.go index 3845f4b7c..e398647c6 100644 --- a/api/secret/create.go +++ b/api/secret/create.go @@ -225,11 +225,6 @@ func CreateSecret(c *gin.Context) { input.SetAllowEvents(e) } - if len(input.GetEvents()) == 0 { - // set default events to enable for the secret - input.SetEvents([]string{constants.EventPush, constants.EventTag, constants.EventDeploy}) - } - if input.AllowCommand == nil { input.SetAllowCommand(true) } diff --git a/api/secret/update.go b/api/secret/update.go index 98c78e031..aecadcc86 100644 --- a/api/secret/update.go +++ b/api/secret/update.go @@ -143,10 +143,6 @@ func UpdateSecret(c *gin.Context) { input.SetImages(util.Unique(input.GetImages())) } - if len(input.GetEvents()) > 0 { - input.SetEvents(util.Unique(input.GetEvents())) - } - if input.AllowCommand != nil { // update allow_command if set input.SetAllowCommand(input.GetAllowCommand()) diff --git a/compiler/native/environment_test.go b/compiler/native/environment_test.go index a6a598acc..01755972e 100644 --- a/compiler/native/environment_test.go +++ b/compiler/native/environment_test.go @@ -103,113 +103,103 @@ func TestNative_EnvironmentSteps(t *testing.T) { Name: str, Pull: "always", Environment: raw.StringSliceMap{ - "BUILD_AUTHOR": "", - "BUILD_AUTHOR_EMAIL": "", - "BUILD_BASE_REF": "", - "BUILD_BRANCH": "", - "BUILD_CHANNEL": "TODO", - "BUILD_CLONE": "", - "BUILD_COMMIT": "", - "BUILD_CREATED": "0", - "BUILD_ENQUEUED": "0", - "BUILD_EVENT": "", - "BUILD_HOST": "", - "BUILD_LINK": "", - "BUILD_MESSAGE": "", - "BUILD_NUMBER": "0", - "BUILD_PARENT": "0", - "BUILD_REF": "", - "BUILD_SENDER": "", - "BUILD_SOURCE": "", - "BUILD_STARTED": "0", - "BUILD_STATUS": "", - "BUILD_TITLE": "", - "BUILD_WORKSPACE": "/vela/src", - "CI": "true", - "REPOSITORY_ACTIVE": "false", - "REPOSITORY_ALLOW_COMMENT": "false", - "REPOSITORY_ALLOW_DEPLOY": "false", - "REPOSITORY_ALLOW_PULL": "false", - "REPOSITORY_ALLOW_PUSH": "false", - "REPOSITORY_ALLOW_TAG": "false", - "REPOSITORY_ALLOW_EVENTS": "", - "REPOSITORY_BRANCH": "", - "REPOSITORY_CLONE": "", - "REPOSITORY_FULL_NAME": "", - "REPOSITORY_LINK": "", - "REPOSITORY_NAME": "", - "REPOSITORY_ORG": "", - "REPOSITORY_PRIVATE": "false", - "REPOSITORY_TIMEOUT": "0", - "REPOSITORY_TRUSTED": "false", - "REPOSITORY_VISIBILITY": "", - "VELA": "true", - "VELA_ADDR": "TODO", - "VELA_BUILD_APPROVED_AT": "0", - "VELA_BUILD_APPROVED_BY": "", - "VELA_BUILD_AUTHOR": "", - "VELA_BUILD_AUTHOR_EMAIL": "", - "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "", - "VELA_BUILD_CHANNEL": "TODO", - "VELA_BUILD_CLONE": "", - "VELA_BUILD_COMMIT": "", - "VELA_BUILD_CREATED": "0", - "VELA_BUILD_DISTRIBUTION": "", - "VELA_BUILD_ENQUEUED": "0", - "VELA_BUILD_EVENT": "", - "VELA_BUILD_EVENT_ACTION": "", - "VELA_BUILD_HOST": "", - "VELA_BUILD_LINK": "", - "VELA_BUILD_MESSAGE": "", - "VELA_BUILD_NUMBER": "0", - "VELA_BUILD_PARENT": "0", - "VELA_BUILD_REF": "", - "VELA_BUILD_RUNTIME": "", - "VELA_BUILD_SENDER": "", - "VELA_BUILD_SOURCE": "", - "VELA_BUILD_STARTED": "0", - "VELA_BUILD_STATUS": "", - "VELA_BUILD_TITLE": "", - "VELA_BUILD_WORKSPACE": "/vela/src", - "VELA_CHANNEL": "TODO", - "VELA_DATABASE": "TODO", - "VELA_DISTRIBUTION": "TODO", - "VELA_HOST": "TODO", - "VELA_NETRC_MACHINE": "TODO", - "VELA_NETRC_PASSWORD": "", - "VELA_NETRC_USERNAME": "x-oauth-basic", - "VELA_QUEUE": "TODO", - "VELA_REPO_ACTIVE": "false", - "VELA_REPO_ALLOW_COMMENT": "false", - "VELA_REPO_ALLOW_DEPLOY": "false", - "VELA_REPO_ALLOW_PULL": "false", - "VELA_REPO_ALLOW_PUSH": "false", - "VELA_REPO_ALLOW_TAG": "false", - "VELA_REPO_ALLOW_EVENTS": "", - "VELA_REPO_APPROVE_BUILD": "", - "VELA_REPO_BRANCH": "", - "VELA_REPO_TOPICS": "", - "VELA_REPO_BUILD_LIMIT": "0", - "VELA_REPO_CLONE": "", - "VELA_REPO_FULL_NAME": "", - "VELA_REPO_LINK": "", - "VELA_REPO_NAME": "", - "VELA_REPO_ORG": "", - "VELA_REPO_PIPELINE_TYPE": "", - "VELA_REPO_PRIVATE": "false", - "VELA_REPO_TIMEOUT": "0", - "VELA_REPO_TRUSTED": "false", - "VELA_REPO_VISIBILITY": "", - "VELA_RUNTIME": "TODO", - "VELA_SOURCE": "TODO", - "VELA_USER_ACTIVE": "false", - "VELA_USER_ADMIN": "false", - "VELA_USER_FAVORITES": "[]", - "VELA_USER_NAME": "", - "VELA_VERSION": "TODO", - "VELA_WORKSPACE": "/vela/src", - "HELLO": "Hello, Stage Message", + "BUILD_AUTHOR": "", + "BUILD_AUTHOR_EMAIL": "", + "BUILD_BASE_REF": "", + "BUILD_BRANCH": "", + "BUILD_CHANNEL": "TODO", + "BUILD_CLONE": "", + "BUILD_COMMIT": "", + "BUILD_CREATED": "0", + "BUILD_ENQUEUED": "0", + "BUILD_EVENT": "", + "BUILD_HOST": "", + "BUILD_LINK": "", + "BUILD_MESSAGE": "", + "BUILD_NUMBER": "0", + "BUILD_PARENT": "0", + "BUILD_REF": "", + "BUILD_SENDER": "", + "BUILD_SOURCE": "", + "BUILD_STARTED": "0", + "BUILD_STATUS": "", + "BUILD_TITLE": "", + "BUILD_WORKSPACE": "/vela/src", + "CI": "true", + "REPOSITORY_ACTIVE": "false", + "REPOSITORY_ALLOW_EVENTS": "", + "REPOSITORY_BRANCH": "", + "REPOSITORY_CLONE": "", + "REPOSITORY_FULL_NAME": "", + "REPOSITORY_LINK": "", + "REPOSITORY_NAME": "", + "REPOSITORY_ORG": "", + "REPOSITORY_PRIVATE": "false", + "REPOSITORY_TIMEOUT": "0", + "REPOSITORY_TRUSTED": "false", + "REPOSITORY_VISIBILITY": "", + "VELA": "true", + "VELA_ADDR": "TODO", + "VELA_BUILD_APPROVED_AT": "0", + "VELA_BUILD_APPROVED_BY": "", + "VELA_BUILD_AUTHOR": "", + "VELA_BUILD_AUTHOR_EMAIL": "", + "VELA_BUILD_BASE_REF": "", + "VELA_BUILD_BRANCH": "", + "VELA_BUILD_CHANNEL": "TODO", + "VELA_BUILD_CLONE": "", + "VELA_BUILD_COMMIT": "", + "VELA_BUILD_CREATED": "0", + "VELA_BUILD_DISTRIBUTION": "", + "VELA_BUILD_ENQUEUED": "0", + "VELA_BUILD_EVENT": "", + "VELA_BUILD_EVENT_ACTION": "", + "VELA_BUILD_HOST": "", + "VELA_BUILD_LINK": "", + "VELA_BUILD_MESSAGE": "", + "VELA_BUILD_NUMBER": "0", + "VELA_BUILD_PARENT": "0", + "VELA_BUILD_REF": "", + "VELA_BUILD_RUNTIME": "", + "VELA_BUILD_SENDER": "", + "VELA_BUILD_SOURCE": "", + "VELA_BUILD_STARTED": "0", + "VELA_BUILD_STATUS": "", + "VELA_BUILD_TITLE": "", + "VELA_BUILD_WORKSPACE": "/vela/src", + "VELA_CHANNEL": "TODO", + "VELA_DATABASE": "TODO", + "VELA_DISTRIBUTION": "TODO", + "VELA_HOST": "TODO", + "VELA_NETRC_MACHINE": "TODO", + "VELA_NETRC_PASSWORD": "", + "VELA_NETRC_USERNAME": "x-oauth-basic", + "VELA_QUEUE": "TODO", + "VELA_REPO_ACTIVE": "false", + "VELA_REPO_ALLOW_EVENTS": "", + "VELA_REPO_APPROVE_BUILD": "", + "VELA_REPO_BRANCH": "", + "VELA_REPO_TOPICS": "", + "VELA_REPO_BUILD_LIMIT": "0", + "VELA_REPO_CLONE": "", + "VELA_REPO_FULL_NAME": "", + "VELA_REPO_LINK": "", + "VELA_REPO_NAME": "", + "VELA_REPO_ORG": "", + "VELA_REPO_PIPELINE_TYPE": "", + "VELA_REPO_PRIVATE": "false", + "VELA_REPO_TIMEOUT": "0", + "VELA_REPO_TRUSTED": "false", + "VELA_REPO_VISIBILITY": "", + "VELA_RUNTIME": "TODO", + "VELA_SOURCE": "TODO", + "VELA_USER_ACTIVE": "false", + "VELA_USER_ADMIN": "false", + "VELA_USER_FAVORITES": "[]", + "VELA_USER_NAME": "", + "VELA_VERSION": "TODO", + "VELA_WORKSPACE": "/vela/src", + "HELLO": "Hello, Stage Message", }, }, } @@ -287,113 +277,103 @@ func TestNative_EnvironmentServices(t *testing.T) { Name: str, Pull: "always", Environment: raw.StringSliceMap{ - "BUILD_AUTHOR": "", - "BUILD_AUTHOR_EMAIL": "", - "BUILD_BASE_REF": "", - "BUILD_BRANCH": "", - "BUILD_CHANNEL": "TODO", - "BUILD_CLONE": "", - "BUILD_COMMIT": "", - "BUILD_CREATED": "0", - "BUILD_ENQUEUED": "0", - "BUILD_EVENT": "", - "BUILD_HOST": "", - "BUILD_LINK": "", - "BUILD_MESSAGE": "", - "BUILD_NUMBER": "0", - "BUILD_PARENT": "0", - "BUILD_REF": "", - "BUILD_SENDER": "", - "BUILD_SOURCE": "", - "BUILD_STARTED": "0", - "BUILD_STATUS": "", - "BUILD_TITLE": "", - "BUILD_WORKSPACE": "/vela/src", - "CI": "true", - "REPOSITORY_ACTIVE": "false", - "REPOSITORY_ALLOW_COMMENT": "false", - "REPOSITORY_ALLOW_DEPLOY": "false", - "REPOSITORY_ALLOW_PULL": "false", - "REPOSITORY_ALLOW_PUSH": "false", - "REPOSITORY_ALLOW_TAG": "false", - "REPOSITORY_ALLOW_EVENTS": "", - "REPOSITORY_BRANCH": "", - "REPOSITORY_CLONE": "", - "REPOSITORY_FULL_NAME": "", - "REPOSITORY_LINK": "", - "REPOSITORY_NAME": "", - "REPOSITORY_ORG": "", - "REPOSITORY_PRIVATE": "false", - "REPOSITORY_TIMEOUT": "0", - "REPOSITORY_TRUSTED": "false", - "REPOSITORY_VISIBILITY": "", - "VELA": "true", - "VELA_ADDR": "TODO", - "VELA_BUILD_APPROVED_AT": "0", - "VELA_BUILD_APPROVED_BY": "", - "VELA_BUILD_AUTHOR": "", - "VELA_BUILD_AUTHOR_EMAIL": "", - "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "", - "VELA_BUILD_CHANNEL": "TODO", - "VELA_BUILD_CLONE": "", - "VELA_BUILD_COMMIT": "", - "VELA_BUILD_CREATED": "0", - "VELA_BUILD_DISTRIBUTION": "", - "VELA_BUILD_ENQUEUED": "0", - "VELA_BUILD_EVENT": "", - "VELA_BUILD_EVENT_ACTION": "", - "VELA_BUILD_HOST": "", - "VELA_BUILD_LINK": "", - "VELA_BUILD_MESSAGE": "", - "VELA_BUILD_NUMBER": "0", - "VELA_BUILD_PARENT": "0", - "VELA_BUILD_REF": "", - "VELA_BUILD_RUNTIME": "", - "VELA_BUILD_SENDER": "", - "VELA_BUILD_SOURCE": "", - "VELA_BUILD_STARTED": "0", - "VELA_BUILD_STATUS": "", - "VELA_BUILD_TITLE": "", - "VELA_BUILD_WORKSPACE": "/vela/src", - "VELA_CHANNEL": "TODO", - "VELA_DATABASE": "TODO", - "VELA_DISTRIBUTION": "TODO", - "VELA_HOST": "TODO", - "VELA_NETRC_MACHINE": "TODO", - "VELA_NETRC_PASSWORD": "", - "VELA_NETRC_USERNAME": "x-oauth-basic", - "VELA_QUEUE": "TODO", - "VELA_REPO_ACTIVE": "false", - "VELA_REPO_ALLOW_COMMENT": "false", - "VELA_REPO_ALLOW_DEPLOY": "false", - "VELA_REPO_ALLOW_PULL": "false", - "VELA_REPO_ALLOW_PUSH": "false", - "VELA_REPO_ALLOW_TAG": "false", - "VELA_REPO_ALLOW_EVENTS": "", - "VELA_REPO_APPROVE_BUILD": "", - "VELA_REPO_BRANCH": "", - "VELA_REPO_TOPICS": "", - "VELA_REPO_BUILD_LIMIT": "0", - "VELA_REPO_CLONE": "", - "VELA_REPO_FULL_NAME": "", - "VELA_REPO_LINK": "", - "VELA_REPO_NAME": "", - "VELA_REPO_ORG": "", - "VELA_REPO_PIPELINE_TYPE": "", - "VELA_REPO_PRIVATE": "false", - "VELA_REPO_TIMEOUT": "0", - "VELA_REPO_TRUSTED": "false", - "VELA_REPO_VISIBILITY": "", - "VELA_RUNTIME": "TODO", - "VELA_SOURCE": "TODO", - "VELA_USER_ACTIVE": "false", - "VELA_USER_ADMIN": "false", - "VELA_USER_FAVORITES": "[]", - "VELA_USER_NAME": "", - "VELA_VERSION": "TODO", - "VELA_WORKSPACE": "/vela/src", - "HELLO": "Hello, Global Message", + "BUILD_AUTHOR": "", + "BUILD_AUTHOR_EMAIL": "", + "BUILD_BASE_REF": "", + "BUILD_BRANCH": "", + "BUILD_CHANNEL": "TODO", + "BUILD_CLONE": "", + "BUILD_COMMIT": "", + "BUILD_CREATED": "0", + "BUILD_ENQUEUED": "0", + "BUILD_EVENT": "", + "BUILD_HOST": "", + "BUILD_LINK": "", + "BUILD_MESSAGE": "", + "BUILD_NUMBER": "0", + "BUILD_PARENT": "0", + "BUILD_REF": "", + "BUILD_SENDER": "", + "BUILD_SOURCE": "", + "BUILD_STARTED": "0", + "BUILD_STATUS": "", + "BUILD_TITLE": "", + "BUILD_WORKSPACE": "/vela/src", + "CI": "true", + "REPOSITORY_ACTIVE": "false", + "REPOSITORY_ALLOW_EVENTS": "", + "REPOSITORY_BRANCH": "", + "REPOSITORY_CLONE": "", + "REPOSITORY_FULL_NAME": "", + "REPOSITORY_LINK": "", + "REPOSITORY_NAME": "", + "REPOSITORY_ORG": "", + "REPOSITORY_PRIVATE": "false", + "REPOSITORY_TIMEOUT": "0", + "REPOSITORY_TRUSTED": "false", + "REPOSITORY_VISIBILITY": "", + "VELA": "true", + "VELA_ADDR": "TODO", + "VELA_BUILD_APPROVED_AT": "0", + "VELA_BUILD_APPROVED_BY": "", + "VELA_BUILD_AUTHOR": "", + "VELA_BUILD_AUTHOR_EMAIL": "", + "VELA_BUILD_BASE_REF": "", + "VELA_BUILD_BRANCH": "", + "VELA_BUILD_CHANNEL": "TODO", + "VELA_BUILD_CLONE": "", + "VELA_BUILD_COMMIT": "", + "VELA_BUILD_CREATED": "0", + "VELA_BUILD_DISTRIBUTION": "", + "VELA_BUILD_ENQUEUED": "0", + "VELA_BUILD_EVENT": "", + "VELA_BUILD_EVENT_ACTION": "", + "VELA_BUILD_HOST": "", + "VELA_BUILD_LINK": "", + "VELA_BUILD_MESSAGE": "", + "VELA_BUILD_NUMBER": "0", + "VELA_BUILD_PARENT": "0", + "VELA_BUILD_REF": "", + "VELA_BUILD_RUNTIME": "", + "VELA_BUILD_SENDER": "", + "VELA_BUILD_SOURCE": "", + "VELA_BUILD_STARTED": "0", + "VELA_BUILD_STATUS": "", + "VELA_BUILD_TITLE": "", + "VELA_BUILD_WORKSPACE": "/vela/src", + "VELA_CHANNEL": "TODO", + "VELA_DATABASE": "TODO", + "VELA_DISTRIBUTION": "TODO", + "VELA_HOST": "TODO", + "VELA_NETRC_MACHINE": "TODO", + "VELA_NETRC_PASSWORD": "", + "VELA_NETRC_USERNAME": "x-oauth-basic", + "VELA_QUEUE": "TODO", + "VELA_REPO_ACTIVE": "false", + "VELA_REPO_ALLOW_EVENTS": "", + "VELA_REPO_APPROVE_BUILD": "", + "VELA_REPO_BRANCH": "", + "VELA_REPO_TOPICS": "", + "VELA_REPO_BUILD_LIMIT": "0", + "VELA_REPO_CLONE": "", + "VELA_REPO_FULL_NAME": "", + "VELA_REPO_LINK": "", + "VELA_REPO_NAME": "", + "VELA_REPO_ORG": "", + "VELA_REPO_PIPELINE_TYPE": "", + "VELA_REPO_PRIVATE": "false", + "VELA_REPO_TIMEOUT": "0", + "VELA_REPO_TRUSTED": "false", + "VELA_REPO_VISIBILITY": "", + "VELA_RUNTIME": "TODO", + "VELA_SOURCE": "TODO", + "VELA_USER_ACTIVE": "false", + "VELA_USER_ADMIN": "false", + "VELA_USER_FAVORITES": "[]", + "VELA_USER_NAME": "", + "VELA_VERSION": "TODO", + "VELA_WORKSPACE": "/vela/src", + "HELLO": "Hello, Global Message", }, }, } @@ -452,114 +432,104 @@ func TestNative_EnvironmentSecrets(t *testing.T) { "foo": "bar", }, Environment: raw.StringSliceMap{ - "BUILD_AUTHOR": "", - "BUILD_AUTHOR_EMAIL": "", - "BUILD_BASE_REF": "", - "BUILD_BRANCH": "", - "BUILD_CHANNEL": "TODO", - "BUILD_CLONE": "", - "BUILD_COMMIT": "", - "BUILD_CREATED": "0", - "BUILD_ENQUEUED": "0", - "BUILD_EVENT": "", - "BUILD_HOST": "", - "BUILD_LINK": "", - "BUILD_MESSAGE": "", - "BUILD_NUMBER": "0", - "BUILD_PARENT": "0", - "BUILD_REF": "", - "BUILD_SENDER": "", - "BUILD_SOURCE": "", - "BUILD_STARTED": "0", - "BUILD_STATUS": "", - "BUILD_TITLE": "", - "BUILD_WORKSPACE": "/vela/src", - "CI": "true", - "PARAMETER_FOO": "bar", - "REPOSITORY_ACTIVE": "false", - "REPOSITORY_ALLOW_COMMENT": "false", - "REPOSITORY_ALLOW_DEPLOY": "false", - "REPOSITORY_ALLOW_PULL": "false", - "REPOSITORY_ALLOW_PUSH": "false", - "REPOSITORY_ALLOW_TAG": "false", - "REPOSITORY_ALLOW_EVENTS": "", - "REPOSITORY_BRANCH": "", - "REPOSITORY_CLONE": "", - "REPOSITORY_FULL_NAME": "", - "REPOSITORY_LINK": "", - "REPOSITORY_NAME": "", - "REPOSITORY_ORG": "", - "REPOSITORY_PRIVATE": "false", - "REPOSITORY_TIMEOUT": "0", - "REPOSITORY_TRUSTED": "false", - "REPOSITORY_VISIBILITY": "", - "VELA": "true", - "VELA_ADDR": "TODO", - "VELA_BUILD_APPROVED_AT": "0", - "VELA_BUILD_APPROVED_BY": "", - "VELA_BUILD_AUTHOR": "", - "VELA_BUILD_AUTHOR_EMAIL": "", - "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "", - "VELA_BUILD_CHANNEL": "TODO", - "VELA_BUILD_CLONE": "", - "VELA_BUILD_COMMIT": "", - "VELA_BUILD_CREATED": "0", - "VELA_BUILD_DISTRIBUTION": "", - "VELA_BUILD_ENQUEUED": "0", - "VELA_BUILD_EVENT": "", - "VELA_BUILD_EVENT_ACTION": "", - "VELA_BUILD_HOST": "", - "VELA_BUILD_LINK": "", - "VELA_BUILD_MESSAGE": "", - "VELA_BUILD_NUMBER": "0", - "VELA_BUILD_PARENT": "0", - "VELA_BUILD_REF": "", - "VELA_BUILD_RUNTIME": "", - "VELA_BUILD_SENDER": "", - "VELA_BUILD_SOURCE": "", - "VELA_BUILD_STARTED": "0", - "VELA_BUILD_STATUS": "", - "VELA_BUILD_TITLE": "", - "VELA_BUILD_WORKSPACE": "/vela/src", - "VELA_CHANNEL": "TODO", - "VELA_DATABASE": "TODO", - "VELA_DISTRIBUTION": "TODO", - "VELA_HOST": "TODO", - "VELA_NETRC_MACHINE": "TODO", - "VELA_NETRC_PASSWORD": "", - "VELA_NETRC_USERNAME": "x-oauth-basic", - "VELA_QUEUE": "TODO", - "VELA_REPO_ACTIVE": "false", - "VELA_REPO_ALLOW_COMMENT": "false", - "VELA_REPO_ALLOW_DEPLOY": "false", - "VELA_REPO_ALLOW_PULL": "false", - "VELA_REPO_ALLOW_PUSH": "false", - "VELA_REPO_ALLOW_TAG": "false", - "VELA_REPO_ALLOW_EVENTS": "", - "VELA_REPO_APPROVE_BUILD": "", - "VELA_REPO_BRANCH": "", - "VELA_REPO_TOPICS": "", - "VELA_REPO_BUILD_LIMIT": "0", - "VELA_REPO_CLONE": "", - "VELA_REPO_FULL_NAME": "", - "VELA_REPO_LINK": "", - "VELA_REPO_NAME": "", - "VELA_REPO_ORG": "", - "VELA_REPO_PIPELINE_TYPE": "", - "VELA_REPO_PRIVATE": "false", - "VELA_REPO_TIMEOUT": "0", - "VELA_REPO_TRUSTED": "false", - "VELA_REPO_VISIBILITY": "", - "VELA_RUNTIME": "TODO", - "VELA_SOURCE": "TODO", - "VELA_USER_ACTIVE": "false", - "VELA_USER_ADMIN": "false", - "VELA_USER_FAVORITES": "[]", - "VELA_USER_NAME": "", - "VELA_VERSION": "TODO", - "VELA_WORKSPACE": "/vela/src", - "HELLO": "Hello, Global Message", + "BUILD_AUTHOR": "", + "BUILD_AUTHOR_EMAIL": "", + "BUILD_BASE_REF": "", + "BUILD_BRANCH": "", + "BUILD_CHANNEL": "TODO", + "BUILD_CLONE": "", + "BUILD_COMMIT": "", + "BUILD_CREATED": "0", + "BUILD_ENQUEUED": "0", + "BUILD_EVENT": "", + "BUILD_HOST": "", + "BUILD_LINK": "", + "BUILD_MESSAGE": "", + "BUILD_NUMBER": "0", + "BUILD_PARENT": "0", + "BUILD_REF": "", + "BUILD_SENDER": "", + "BUILD_SOURCE": "", + "BUILD_STARTED": "0", + "BUILD_STATUS": "", + "BUILD_TITLE": "", + "BUILD_WORKSPACE": "/vela/src", + "CI": "true", + "PARAMETER_FOO": "bar", + "REPOSITORY_ACTIVE": "false", + "REPOSITORY_ALLOW_EVENTS": "", + "REPOSITORY_BRANCH": "", + "REPOSITORY_CLONE": "", + "REPOSITORY_FULL_NAME": "", + "REPOSITORY_LINK": "", + "REPOSITORY_NAME": "", + "REPOSITORY_ORG": "", + "REPOSITORY_PRIVATE": "false", + "REPOSITORY_TIMEOUT": "0", + "REPOSITORY_TRUSTED": "false", + "REPOSITORY_VISIBILITY": "", + "VELA": "true", + "VELA_ADDR": "TODO", + "VELA_BUILD_APPROVED_AT": "0", + "VELA_BUILD_APPROVED_BY": "", + "VELA_BUILD_AUTHOR": "", + "VELA_BUILD_AUTHOR_EMAIL": "", + "VELA_BUILD_BASE_REF": "", + "VELA_BUILD_BRANCH": "", + "VELA_BUILD_CHANNEL": "TODO", + "VELA_BUILD_CLONE": "", + "VELA_BUILD_COMMIT": "", + "VELA_BUILD_CREATED": "0", + "VELA_BUILD_DISTRIBUTION": "", + "VELA_BUILD_ENQUEUED": "0", + "VELA_BUILD_EVENT": "", + "VELA_BUILD_EVENT_ACTION": "", + "VELA_BUILD_HOST": "", + "VELA_BUILD_LINK": "", + "VELA_BUILD_MESSAGE": "", + "VELA_BUILD_NUMBER": "0", + "VELA_BUILD_PARENT": "0", + "VELA_BUILD_REF": "", + "VELA_BUILD_RUNTIME": "", + "VELA_BUILD_SENDER": "", + "VELA_BUILD_SOURCE": "", + "VELA_BUILD_STARTED": "0", + "VELA_BUILD_STATUS": "", + "VELA_BUILD_TITLE": "", + "VELA_BUILD_WORKSPACE": "/vela/src", + "VELA_CHANNEL": "TODO", + "VELA_DATABASE": "TODO", + "VELA_DISTRIBUTION": "TODO", + "VELA_HOST": "TODO", + "VELA_NETRC_MACHINE": "TODO", + "VELA_NETRC_PASSWORD": "", + "VELA_NETRC_USERNAME": "x-oauth-basic", + "VELA_QUEUE": "TODO", + "VELA_REPO_ACTIVE": "false", + "VELA_REPO_ALLOW_EVENTS": "", + "VELA_REPO_APPROVE_BUILD": "", + "VELA_REPO_BRANCH": "", + "VELA_REPO_TOPICS": "", + "VELA_REPO_BUILD_LIMIT": "0", + "VELA_REPO_CLONE": "", + "VELA_REPO_FULL_NAME": "", + "VELA_REPO_LINK": "", + "VELA_REPO_NAME": "", + "VELA_REPO_ORG": "", + "VELA_REPO_PIPELINE_TYPE": "", + "VELA_REPO_PRIVATE": "false", + "VELA_REPO_TIMEOUT": "0", + "VELA_REPO_TRUSTED": "false", + "VELA_REPO_VISIBILITY": "", + "VELA_RUNTIME": "TODO", + "VELA_SOURCE": "TODO", + "VELA_USER_ACTIVE": "false", + "VELA_USER_ADMIN": "false", + "VELA_USER_FAVORITES": "[]", + "VELA_USER_NAME": "", + "VELA_VERSION": "TODO", + "VELA_WORKSPACE": "/vela/src", + "HELLO": "Hello, Global Message", }, }, }, @@ -576,7 +546,7 @@ func TestNative_EnvironmentSecrets(t *testing.T) { t.Errorf("EnvironmentSecrets returned err: %v", err) } - if diff := cmp.Diff(got, want); diff != "" { + if diff := cmp.Diff(want, got); diff != "" { t.Errorf("EnvironmentSecrets mismatch (-want +got):\n%s", diff) } } @@ -615,36 +585,36 @@ func TestNative_environment(t *testing.T) { w: workspace, b: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &push, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &str, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &str, BaseRef: &str}, m: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, u: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "push", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "foo", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "push", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "foo", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "push", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "foo", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "push", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "foo", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, // tag { w: workspace, b: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &tag, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &str, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &tagref, BaseRef: &str}, m: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, u: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "tag", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/tags/1", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TAG": "1", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "tag", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/tags/1", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TAG": "1", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "tag", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/tags/1", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TAG": "1", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "tag", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/tags/1", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TAG": "1", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, // pull_request { w: workspace, b: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &pull, EventAction: &pullact, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &str, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &pullref, BaseRef: &str}, m: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, u: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "pull_request", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_PULL_REQUEST_NUMBER": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "pull_request", "VELA_BUILD_EVENT_ACTION": "opened", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_PULL_REQUEST": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_PULL_REQUEST": "1", "VELA_PULL_REQUEST_SOURCE": "", "VELA_PULL_REQUEST_TARGET": "foo", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "pull_request", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_PULL_REQUEST_NUMBER": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "pull_request", "VELA_BUILD_EVENT_ACTION": "opened", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_PULL_REQUEST": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_PULL_REQUEST": "1", "VELA_PULL_REQUEST_SOURCE": "", "VELA_PULL_REQUEST_TARGET": "foo", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, // deployment { w: workspace, b: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &deploy, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &target, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &pullref, BaseRef: &str}, m: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + r: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, u: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "deployment", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TARGET": "production", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "deployment", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TARGET": "production", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DEPLOYMENT": "production", "VELA_DEPLOYMENT_NUMBER": "0", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + want: map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "deployment", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TARGET": "production", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "deployment", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TARGET": "production", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DEPLOYMENT": "production", "VELA_DEPLOYMENT_NUMBER": "0", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, } @@ -731,29 +701,29 @@ func Test_client_EnvironmentBuild(t *testing.T) { {"push", fields{ build: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &push, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &str, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &str, BaseRef: &str}, metadata: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, user: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "push", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "foo", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "push", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "foo", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}}, + }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "push", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "foo", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "push", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "foo", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}}, {"tag", fields{ build: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &tag, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &str, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &tagref, BaseRef: &str}, metadata: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, user: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "tag", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/tags/1", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TAG": "1", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "tag", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/tags/1", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TAG": "1", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "tag", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/tags/1", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TAG": "1", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "tag", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/tags/1", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TAG": "1", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, {"pull_request", fields{ build: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &pull, EventAction: &pullact, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &str, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &pullref, BaseRef: &str}, metadata: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, user: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "pull_request", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_PULL_REQUEST_NUMBER": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "pull_request", "VELA_BUILD_EVENT_ACTION": "opened", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_PULL_REQUEST": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_PULL_REQUEST": "1", "VELA_PULL_REQUEST_SOURCE": "", "VELA_PULL_REQUEST_TARGET": "foo", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "pull_request", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_PULL_REQUEST_NUMBER": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "pull_request", "VELA_BUILD_EVENT_ACTION": "opened", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_PULL_REQUEST": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_PULL_REQUEST": "1", "VELA_PULL_REQUEST_SOURCE": "", "VELA_PULL_REQUEST_TARGET": "foo", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, {"deployment", fields{ build: &library.Build{ID: &num64, RepoID: &num64, Number: &num, Parent: &num, Event: &deploy, Status: &str, Error: &str, Enqueued: &num64, Created: &num64, Started: &num64, Finished: &num64, Deploy: &target, Clone: &str, Source: &str, Title: &str, Message: &str, Commit: &str, Sender: &str, Author: &str, Branch: &str, Ref: &pullref, BaseRef: &str}, metadata: &types.Metadata{Database: &types.Database{Driver: str, Host: str}, Queue: &types.Queue{Channel: str, Driver: str, Host: str}, Source: &types.Source{Driver: str, Host: str}, Vela: &types.Vela{Address: str, WebAddress: str}}, - repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL, AllowPull: &booL, AllowPush: &booL, AllowDeploy: &booL, AllowTag: &booL, AllowComment: &booL}, + repo: &library.Repo{ID: &num64, UserID: &num64, Org: &str, Name: &str, FullName: &str, Link: &str, Clone: &str, Branch: &str, Topics: &topics, BuildLimit: &num64, Timeout: &num64, Visibility: &str, Private: &booL, Trusted: &booL, Active: &booL}, user: &library.User{ID: &num64, Name: &str, Token: &str, Active: &booL, Admin: &booL}, - }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "deployment", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TARGET": "production", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_COMMENT": "false", "REPOSITORY_ALLOW_DEPLOY": "false", "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "false", "REPOSITORY_ALLOW_TAG": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "deployment", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TARGET": "production", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DEPLOYMENT": "production", "VELA_DEPLOYMENT_NUMBER": "0", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_COMMENT": "false", "VELA_REPO_ALLOW_DEPLOY": "false", "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "false", "VELA_REPO_ALLOW_TAG": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, + }, map[string]string{"BUILD_AUTHOR": "foo", "BUILD_AUTHOR_EMAIL": "", "BUILD_BASE_REF": "foo", "BUILD_BRANCH": "foo", "BUILD_CHANNEL": "foo", "BUILD_CLONE": "foo", "BUILD_COMMIT": "foo", "BUILD_CREATED": "1", "BUILD_ENQUEUED": "1", "BUILD_EVENT": "deployment", "BUILD_HOST": "", "BUILD_LINK": "", "BUILD_MESSAGE": "foo", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", "BUILD_REF": "refs/pull/1/head", "BUILD_SENDER": "foo", "BUILD_SOURCE": "foo", "BUILD_STARTED": "1", "BUILD_STATUS": "foo", "BUILD_TARGET": "production", "BUILD_TITLE": "foo", "BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "CI": "true", "REPOSITORY_ACTIVE": "false", "REPOSITORY_ALLOW_EVENTS": "", "REPOSITORY_BRANCH": "foo", "REPOSITORY_CLONE": "foo", "REPOSITORY_FULL_NAME": "foo", "REPOSITORY_LINK": "foo", "REPOSITORY_NAME": "foo", "REPOSITORY_ORG": "foo", "REPOSITORY_PRIVATE": "false", "REPOSITORY_TIMEOUT": "1", "REPOSITORY_TRUSTED": "false", "REPOSITORY_VISIBILITY": "foo", "VELA": "true", "VELA_ADDR": "foo", "VELA_BUILD_APPROVED_AT": "0", "VELA_BUILD_APPROVED_BY": "", "VELA_BUILD_AUTHOR": "foo", "VELA_BUILD_AUTHOR_EMAIL": "", "VELA_BUILD_BASE_REF": "foo", "VELA_BUILD_BRANCH": "foo", "VELA_BUILD_CHANNEL": "foo", "VELA_BUILD_CLONE": "foo", "VELA_BUILD_COMMIT": "foo", "VELA_BUILD_CREATED": "1", "VELA_BUILD_DISTRIBUTION": "", "VELA_BUILD_ENQUEUED": "1", "VELA_BUILD_EVENT": "deployment", "VELA_BUILD_EVENT_ACTION": "", "VELA_BUILD_HOST": "", "VELA_BUILD_LINK": "", "VELA_BUILD_MESSAGE": "foo", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", "VELA_BUILD_REF": "refs/pull/1/head", "VELA_BUILD_RUNTIME": "", "VELA_BUILD_SENDER": "foo", "VELA_BUILD_SOURCE": "foo", "VELA_BUILD_STARTED": "1", "VELA_BUILD_STATUS": "foo", "VELA_BUILD_TARGET": "production", "VELA_BUILD_TITLE": "foo", "VELA_BUILD_WORKSPACE": "/vela/src/foo/foo/foo", "VELA_CHANNEL": "foo", "VELA_DATABASE": "foo", "VELA_DEPLOYMENT": "production", "VELA_DEPLOYMENT_NUMBER": "0", "VELA_DISTRIBUTION": "TODO", "VELA_HOST": "foo", "VELA_NETRC_MACHINE": "foo", "VELA_NETRC_PASSWORD": "foo", "VELA_NETRC_USERNAME": "x-oauth-basic", "VELA_QUEUE": "foo", "VELA_REPO_ACTIVE": "false", "VELA_REPO_ALLOW_EVENTS": "", "VELA_REPO_APPROVE_BUILD": "", "VELA_REPO_BRANCH": "foo", "VELA_REPO_BUILD_LIMIT": "1", "VELA_REPO_CLONE": "foo", "VELA_REPO_FULL_NAME": "foo", "VELA_REPO_LINK": "foo", "VELA_REPO_NAME": "foo", "VELA_REPO_ORG": "foo", "VELA_REPO_PIPELINE_TYPE": "", "VELA_REPO_PRIVATE": "false", "VELA_REPO_TIMEOUT": "1", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_TRUSTED": "false", "VELA_REPO_VISIBILITY": "foo", "VELA_RUNTIME": "TODO", "VELA_SOURCE": "foo", "VELA_USER_ACTIVE": "false", "VELA_USER_ADMIN": "false", "VELA_USER_FAVORITES": "[]", "VELA_USER_NAME": "foo", "VELA_VERSION": "TODO", "VELA_WORKSPACE": "/vela/src/foo/foo/foo"}, }, } for _, tt := range tests { diff --git a/database/build/build_test.go b/database/build/build_test.go index 2478b2ded..16910e5ac 100644 --- a/database/build/build_test.go +++ b/database/build/build_test.go @@ -261,11 +261,6 @@ func testRepo() *library.Repo { Private: new(bool), Trusted: new(bool), Active: new(bool), - AllowPull: new(bool), - AllowPush: new(bool), - AllowDeploy: new(bool), - AllowTag: new(bool), - AllowComment: new(bool), } } diff --git a/database/deployment/deployment_test.go b/database/deployment/deployment_test.go index 4421f4f9d..0184fbcce 100644 --- a/database/deployment/deployment_test.go +++ b/database/deployment/deployment_test.go @@ -208,10 +208,5 @@ func testRepo() *library.Repo { Private: new(bool), Trusted: new(bool), Active: new(bool), - AllowPull: new(bool), - AllowPush: new(bool), - AllowDeploy: new(bool), - AllowTag: new(bool), - AllowComment: new(bool), } } diff --git a/database/hook/hook_test.go b/database/hook/hook_test.go index 4aaeb6a93..fd358715f 100644 --- a/database/hook/hook_test.go +++ b/database/hook/hook_test.go @@ -207,10 +207,5 @@ func testRepo() *library.Repo { Private: new(bool), Trusted: new(bool), Active: new(bool), - AllowPull: new(bool), - AllowPush: new(bool), - AllowDeploy: new(bool), - AllowTag: new(bool), - AllowComment: new(bool), } } diff --git a/database/integration_test.go b/database/integration_test.go index ce35d1ec8..0bde55005 100644 --- a/database/integration_test.go +++ b/database/integration_test.go @@ -2239,11 +2239,6 @@ func newResources() *Resources { repoOne.SetPrivate(false) repoOne.SetTrusted(false) repoOne.SetActive(true) - repoOne.SetAllowPull(false) - repoOne.SetAllowPush(true) - repoOne.SetAllowDeploy(false) - repoOne.SetAllowTag(false) - repoOne.SetAllowComment(false) repoOne.SetPipelineType("") repoOne.SetPreviousName("") repoOne.SetApproveBuild(constants.ApproveNever) @@ -2267,11 +2262,6 @@ func newResources() *Resources { repoTwo.SetPrivate(false) repoTwo.SetTrusted(false) repoTwo.SetActive(true) - repoTwo.SetAllowPull(false) - repoTwo.SetAllowPush(true) - repoTwo.SetAllowDeploy(false) - repoTwo.SetAllowTag(false) - repoTwo.SetAllowComment(false) repoTwo.SetPipelineType("") repoTwo.SetPreviousName("") repoTwo.SetApproveBuild(constants.ApproveForkAlways) @@ -2312,7 +2302,6 @@ func newResources() *Resources { secretOrg.SetValue("bar") secretOrg.SetType("org") secretOrg.SetImages([]string{"alpine"}) - secretOrg.SetEvents([]string{"push", "tag", "deployment"}) secretOrg.SetAllowEvents(library.NewEventsFromMask(1)) secretOrg.SetAllowCommand(true) secretOrg.SetAllowSubstitution(true) @@ -2330,7 +2319,6 @@ func newResources() *Resources { secretRepo.SetValue("bar") secretRepo.SetType("repo") secretRepo.SetImages([]string{"alpine"}) - secretRepo.SetEvents([]string{"push", "tag", "deployment"}) secretRepo.SetAllowEvents(library.NewEventsFromMask(1)) secretRepo.SetAllowCommand(true) secretRepo.SetAllowSubstitution(true) @@ -2348,7 +2336,6 @@ func newResources() *Resources { secretShared.SetValue("bar") secretShared.SetType("shared") secretShared.SetImages([]string{"alpine"}) - secretShared.SetEvents([]string{"push", "tag", "deployment"}) secretShared.SetAllowCommand(true) secretShared.SetAllowSubstitution(true) secretShared.SetAllowEvents(library.NewEventsFromMask(1)) diff --git a/database/repo/create_test.go b/database/repo/create_test.go index 189622744..1a523b563 100644 --- a/database/repo/create_test.go +++ b/database/repo/create_test.go @@ -32,9 +32,9 @@ func TestRepo_Engine_CreateRepo(t *testing.T) { // ensure the mock expects the query _mock.ExpectQuery(`INSERT INTO "repos" -("user_id","hash","org","name","full_name","link","clone","branch","topics","build_limit","timeout","counter","visibility","private","trusted","active","allow_pull","allow_push","allow_deploy","allow_tag","allow_comment","allow_events","pipeline_type","previous_name","approve_build","id") -VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26) RETURNING "id"`). - WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, false, false, false, false, false, nil, "yaml", "oldName", nil, 1). +("user_id","hash","org","name","full_name","link","clone","branch","topics","build_limit","timeout","counter","visibility","private","trusted","active","allow_events","pipeline_type","previous_name","approve_build","id") +VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21) RETURNING "id"`). + WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, nil, "yaml", "oldName", nil, 1). WillReturnRows(_rows) _sqlite := testSqlite(t) diff --git a/database/repo/get_org_test.go b/database/repo/get_org_test.go index 95e6d6a32..db5b36314 100644 --- a/database/repo/get_org_test.go +++ b/database/repo/get_org_test.go @@ -30,8 +30,8 @@ func TestRepo_Engine_GetRepoForOrg(t *testing.T) { // create expected result in mock _rows := sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", "", "") + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, 1, "yaml", "", "") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 AND name = $2 LIMIT $3`).WithArgs("foo", "bar", 1).WillReturnRows(_rows) diff --git a/database/repo/get_test.go b/database/repo/get_test.go index 7a4fcdba8..3957975d2 100644 --- a/database/repo/get_test.go +++ b/database/repo/get_test.go @@ -30,8 +30,8 @@ func TestRepo_Engine_GetRepo(t *testing.T) { // create expected result in mock _rows := sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", "", "") + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "build_limit", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, 1, "yaml", "", "") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "repos" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) diff --git a/database/repo/list_org_test.go b/database/repo/list_org_test.go index 5d6bfb99f..e59e29d49 100644 --- a/database/repo/list_org_test.go +++ b/database/repo/list_org_test.go @@ -63,9 +63,9 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { // create expected name query result in mock _rows = sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil). - AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil). + AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the name query _mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 ORDER BY name LIMIT $2`).WithArgs("foo", 10).WillReturnRows(_rows) @@ -78,9 +78,9 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { // create expected latest query result in mock _rows = sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil). - AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil). + AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the latest query _mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.org = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT $2`).WithArgs("foo", 10).WillReturnRows(_rows) diff --git a/database/repo/list_test.go b/database/repo/list_test.go index 793123257..7b3a5ff5e 100644 --- a/database/repo/list_test.go +++ b/database/repo/list_test.go @@ -48,9 +48,9 @@ func TestRepo_Engine_ListRepos(t *testing.T) { // create expected result in mock _rows = sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil). - AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil). + AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "repos"`).WillReturnRows(_rows) diff --git a/database/repo/list_user_test.go b/database/repo/list_user_test.go index a387c4e5a..30f6bc3b1 100644 --- a/database/repo/list_user_test.go +++ b/database/repo/list_user_test.go @@ -68,9 +68,9 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { // create expected name query result in mock _rows = sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil). - AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil). + AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the name query _mock.ExpectQuery(`SELECT * FROM "repos" WHERE user_id = $1 ORDER BY name LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) @@ -83,9 +83,9 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { // create expected latest query result in mock _rows = sqlmock.NewRows( - []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_pull", "allow_push", "allow_deploy", "allow_tag", "allow_comment", "allow_events", "pipeline_type", "previous_name", "approve_build"}). - AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil). - AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) + []string{"id", "user_id", "hash", "org", "name", "full_name", "link", "clone", "branch", "topics", "timeout", "counter", "visibility", "private", "trusted", "active", "allow_events", "pipeline_type", "previous_name", "approve_build"}). + AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil). + AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the latest query _mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.user_id = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) diff --git a/database/repo/repo_test.go b/database/repo/repo_test.go index 597ef1623..325732a56 100644 --- a/database/repo/repo_test.go +++ b/database/repo/repo_test.go @@ -194,11 +194,6 @@ func testRepo() *library.Repo { Private: new(bool), Trusted: new(bool), Active: new(bool), - AllowPull: new(bool), - AllowPush: new(bool), - AllowDeploy: new(bool), - AllowTag: new(bool), - AllowComment: new(bool), AllowEvents: testEvents(), } } diff --git a/database/repo/table.go b/database/repo/table.go index e0f26a6c3..a7877d280 100644 --- a/database/repo/table.go +++ b/database/repo/table.go @@ -31,11 +31,6 @@ repos ( private BOOLEAN, trusted BOOLEAN, active BOOLEAN, - allow_pull BOOLEAN, - allow_push BOOLEAN, - allow_deploy BOOLEAN, - allow_tag BOOLEAN, - allow_comment BOOLEAN, allow_events INTEGER, pipeline_type TEXT, previous_name VARCHAR(100), @@ -66,11 +61,6 @@ repos ( private BOOLEAN, trusted BOOLEAN, active BOOLEAN, - allow_pull BOOLEAN, - allow_push BOOLEAN, - allow_deploy BOOLEAN, - allow_tag BOOLEAN, - allow_comment BOOLEAN, allow_events INTEGER, pipeline_type TEXT, previous_name TEXT, diff --git a/database/repo/update_test.go b/database/repo/update_test.go index bf791a30d..c7bca1d15 100644 --- a/database/repo/update_test.go +++ b/database/repo/update_test.go @@ -33,9 +33,9 @@ func TestRepo_Engine_UpdateRepo(t *testing.T) { // ensure the mock expects the query _mock.ExpectExec(`UPDATE "repos" -SET "user_id"=$1,"hash"=$2,"org"=$3,"name"=$4,"full_name"=$5,"link"=$6,"clone"=$7,"branch"=$8,"topics"=$9,"build_limit"=$10,"timeout"=$11,"counter"=$12,"visibility"=$13,"private"=$14,"trusted"=$15,"active"=$16,"allow_pull"=$17,"allow_push"=$18,"allow_deploy"=$19,"allow_tag"=$20,"allow_comment"=$21,"allow_events"=$22,"pipeline_type"=$23,"previous_name"=$24,"approve_build"=$25 -WHERE "id" = $26`). - WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, false, false, false, false, false, 1, "yaml", "oldName", constants.ApproveForkAlways, 1). +SET "user_id"=$1,"hash"=$2,"org"=$3,"name"=$4,"full_name"=$5,"link"=$6,"clone"=$7,"branch"=$8,"topics"=$9,"build_limit"=$10,"timeout"=$11,"counter"=$12,"visibility"=$13,"private"=$14,"trusted"=$15,"active"=$16,"allow_events"=$17,"pipeline_type"=$18,"previous_name"=$19,"approve_build"=$20 +WHERE "id" = $21`). + WithArgs(1, AnyArgument{}, "foo", "bar", "foo/bar", nil, nil, nil, AnyArgument{}, AnyArgument{}, AnyArgument{}, AnyArgument{}, "public", false, false, false, 1, "yaml", "oldName", constants.ApproveForkAlways, 1). WillReturnResult(sqlmock.NewResult(1, 1)) _sqlite := testSqlite(t) diff --git a/database/schedule/schedule_test.go b/database/schedule/schedule_test.go index d676223a1..723c40aaa 100644 --- a/database/schedule/schedule_test.go +++ b/database/schedule/schedule_test.go @@ -210,11 +210,6 @@ func testRepo() *library.Repo { Private: new(bool), Trusted: new(bool), Active: new(bool), - AllowPull: new(bool), - AllowPush: new(bool), - AllowDeploy: new(bool), - AllowTag: new(bool), - AllowComment: new(bool), } } diff --git a/database/secret/create_test.go b/database/secret/create_test.go index eeec4c363..210a57b99 100644 --- a/database/secret/create_test.go +++ b/database/secret/create_test.go @@ -60,23 +60,23 @@ func TestSecret_Engine_CreateSecret(t *testing.T) { // ensure the mock expects the repo secrets query _mock.ExpectQuery(`INSERT INTO "secrets" -("org","repo","team","name","value","type","images","events","allow_events","allow_command","allow_substitution","created_at","created_by","updated_at","updated_by","id") -VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) RETURNING "id"`). - WithArgs("foo", "bar", nil, "baz", AnyArgument{}, "repo", nil, nil, 1, false, false, 1, "user", 1, "user2", 1). +("org","repo","team","name","value","type","images","allow_events","allow_command","allow_substitution","created_at","created_by","updated_at","updated_by","id") +VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) RETURNING "id"`). + WithArgs("foo", "bar", nil, "baz", AnyArgument{}, "repo", nil, 1, false, false, 1, "user", 1, "user2", 1). WillReturnRows(_rows) // ensure the mock expects the org secrets query _mock.ExpectQuery(`INSERT INTO "secrets" -("org","repo","team","name","value","type","images","events","allow_events","allow_command","allow_substitution","created_at","created_by","updated_at","updated_by","id") -VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) RETURNING "id"`). - WithArgs("foo", "*", nil, "bar", AnyArgument{}, "org", nil, nil, 3, false, false, 1, "user", 1, "user2", 2). +("org","repo","team","name","value","type","images","allow_events","allow_command","allow_substitution","created_at","created_by","updated_at","updated_by","id") +VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) RETURNING "id"`). + WithArgs("foo", "*", nil, "bar", AnyArgument{}, "org", nil, 3, false, false, 1, "user", 1, "user2", 2). WillReturnRows(_rows) // ensure the mock expects the shared secrets query _mock.ExpectQuery(`INSERT INTO "secrets" -("org","repo","team","name","value","type","images","events","allow_events","allow_command","allow_substitution","created_at","created_by","updated_at","updated_by","id") -VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) RETURNING "id"`). - WithArgs("foo", nil, "bar", "baz", AnyArgument{}, "shared", nil, nil, 1, false, false, 1, "user", 1, "user2", 3). +("org","repo","team","name","value","type","images","allow_events","allow_command","allow_substitution","created_at","created_by","updated_at","updated_by","id") +VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) RETURNING "id"`). + WithArgs("foo", nil, "bar", "baz", AnyArgument{}, "shared", nil, 1, false, false, 1, "user", 1, "user2", 3). WillReturnRows(_rows) _sqlite := testSqlite(t) diff --git a/database/secret/get_org_test.go b/database/secret/get_org_test.go index 840fa2f91..51ca298d2 100644 --- a/database/secret/get_org_test.go +++ b/database/secret/get_org_test.go @@ -32,8 +32,8 @@ func TestSecret_Engine_GetSecretForOrg(t *testing.T) { // create expected result in mock _rows := sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(1, "org", "foo", "*", "", "baz", "bar", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(1, "org", "foo", "*", "", "baz", "bar", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND name = $3 LIMIT $4`). diff --git a/database/secret/get_repo_test.go b/database/secret/get_repo_test.go index c4ed2c472..d32f81cc0 100644 --- a/database/secret/get_repo_test.go +++ b/database/secret/get_repo_test.go @@ -42,8 +42,8 @@ func TestSecret_Engine_GetSecretForRepo(t *testing.T) { // create expected result in mock _rows := sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND repo = $3 AND name = $4 LIMIT $5`). diff --git a/database/secret/get_team_test.go b/database/secret/get_team_test.go index a39012c26..f34e6f2b6 100644 --- a/database/secret/get_team_test.go +++ b/database/secret/get_team_test.go @@ -32,8 +32,8 @@ func TestSecret_Engine_GetSecretForTeam(t *testing.T) { // create expected result in mock _rows := sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND team = $3 AND name = $4 LIMIT $5`). diff --git a/database/secret/get_test.go b/database/secret/get_test.go index 8b8d4d9c5..16e456c12 100644 --- a/database/secret/get_test.go +++ b/database/secret/get_test.go @@ -31,8 +31,8 @@ func TestSecret_Engine_GetSecret(t *testing.T) { // create expected result in mock _rows := sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) diff --git a/database/secret/list_org_test.go b/database/secret/list_org_test.go index 024d7a05a..14493ef38 100644 --- a/database/secret/list_org_test.go +++ b/database/secret/list_org_test.go @@ -52,9 +52,9 @@ func TestSecret_Engine_ListSecretsForOrg(t *testing.T) { // create expected name query result in mock _rows = sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(2, "org", "foo", "*", "", "bar", "baz", nil, nil, 1, false, false, 1, "user", 1, "user2"). - AddRow(1, "org", "foo", "*", "", "baz", "bar", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(2, "org", "foo", "*", "", "bar", "baz", nil, 1, false, false, 1, "user", 1, "user2"). + AddRow(1, "org", "foo", "*", "", "baz", "bar", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the name query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 ORDER BY id DESC LIMIT $3`). diff --git a/database/secret/list_repo_test.go b/database/secret/list_repo_test.go index eb97e4c52..9fc76e7bf 100644 --- a/database/secret/list_repo_test.go +++ b/database/secret/list_repo_test.go @@ -63,9 +63,9 @@ func TestSecret_Engine_ListSecretsForRepo(t *testing.T) { // create expected name query result in mock _rows = sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(2, "repo", "foo", "bar", "", "foob", "baz", nil, nil, 1, false, false, 1, "user", 1, "user2"). - AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(2, "repo", "foo", "bar", "", "foob", "baz", nil, 1, false, false, 1, "user", 1, "user2"). + AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the name query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND repo = $3 ORDER BY id DESC LIMIT $4`). diff --git a/database/secret/list_team_test.go b/database/secret/list_team_test.go index fd925935e..89b40b237 100644 --- a/database/secret/list_team_test.go +++ b/database/secret/list_team_test.go @@ -53,9 +53,9 @@ func TestSecret_Engine_ListSecretsForTeam(t *testing.T) { // create expected name query result in mock _rows = sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(2, "shared", "foo", "", "bar", "foob", "baz", nil, nil, 1, false, false, 1, "user", 1, "user2"). - AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(2, "shared", "foo", "", "bar", "foob", "baz", nil, 1, false, false, 1, "user", 1, "user2"). + AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the name query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND team = $3 ORDER BY id DESC LIMIT $4`). @@ -134,6 +134,7 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { _secretOne.SetCreatedBy("user") _secretOne.SetUpdatedAt(1) _secretOne.SetUpdatedBy("user2") + _secretOne.SetAllowEvents(library.NewEventsFromMask(1)) _secretTwo := testSecret() _secretTwo.SetID(2) @@ -146,6 +147,7 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { _secretTwo.SetCreatedBy("user") _secretTwo.SetUpdatedAt(1) _secretTwo.SetUpdatedBy("user2") + _secretTwo.SetAllowEvents(library.NewEventsFromMask(1)) _postgres, _mock := testPostgres(t) defer func() { _sql, _ := _postgres.client.DB(); _sql.Close() }() @@ -159,9 +161,9 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { // create expected name query result in mock _rows = sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_command", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(2, "shared", "foo", "", "bar", "foob", "baz", nil, nil, false, 1, "user", 1, "user2"). - AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, nil, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(2, "shared", "foo", "", "bar", "foob", "baz", nil, 1, false, 1, "user", 1, "user2"). + AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the name query _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND LOWER(team) IN ($3,$4) ORDER BY id DESC LIMIT $5`). diff --git a/database/secret/list_test.go b/database/secret/list_test.go index a1a0e9e38..c050d452d 100644 --- a/database/secret/list_test.go +++ b/database/secret/list_test.go @@ -50,9 +50,9 @@ func TestSecret_Engine_ListSecrets(t *testing.T) { // create expected result in mock _rows = sqlmock.NewRows( - []string{"id", "type", "org", "repo", "team", "name", "value", "images", "events", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). - AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, false, 1, "user", 1, "user2"). - AddRow(2, "repo", "foo", "bar", "", "foob", "baz", nil, nil, 1, false, false, 1, "user", 1, "user2") + []string{"id", "type", "org", "repo", "team", "name", "value", "images", "allow_events", "allow_command", "allow_substitution", "created_at", "created_by", "updated_at", "updated_by"}). + AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, 1, false, false, 1, "user", 1, "user2"). + AddRow(2, "repo", "foo", "bar", "", "foob", "baz", nil, 1, false, false, 1, "user", 1, "user2") // ensure the mock expects the query _mock.ExpectQuery(`SELECT * FROM "secrets"`).WillReturnRows(_rows) diff --git a/database/secret/secret_test.go b/database/secret/secret_test.go index e4b74ec9a..160f208cb 100644 --- a/database/secret/secret_test.go +++ b/database/secret/secret_test.go @@ -198,11 +198,6 @@ func testRepo() *library.Repo { Private: new(bool), Trusted: new(bool), Active: new(bool), - AllowPull: new(bool), - AllowPush: new(bool), - AllowDeploy: new(bool), - AllowTag: new(bool), - AllowComment: new(bool), } } @@ -218,7 +213,6 @@ func testSecret() *library.Secret { Value: new(string), Type: new(string), Images: new([]string), - Events: new([]string), AllowEvents: testEvents(), AllowCommand: new(bool), AllowSubstitution: new(bool), diff --git a/database/secret/table.go b/database/secret/table.go index 67fd6b8b9..07b84fee8 100644 --- a/database/secret/table.go +++ b/database/secret/table.go @@ -22,7 +22,6 @@ secrets ( name VARCHAR(250), value BYTEA, images VARCHAR(1000), - events VARCHAR(1000), allow_events INTEGER, allow_command BOOLEAN, allow_substitution BOOLEAN, @@ -48,7 +47,6 @@ secrets ( name TEXT, value TEXT, images TEXT, - events TEXT, allow_events INTEGER, allow_command BOOLEAN, allow_substitution BOOLEAN, diff --git a/database/secret/update_test.go b/database/secret/update_test.go index 5797471f2..0502de911 100644 --- a/database/secret/update_test.go +++ b/database/secret/update_test.go @@ -57,23 +57,23 @@ func TestSecret_Engine_UpdateSecret(t *testing.T) { // ensure the mock expects the repo query _mock.ExpectExec(`UPDATE "secrets" -SET "org"=$1,"repo"=$2,"team"=$3,"name"=$4,"value"=$5,"type"=$6,"images"=$7,"events"=$8,"allow_events"=$9,"allow_command"=$10,"allow_substitution"=$11,"created_at"=$12,"created_by"=$13,"updated_at"=$14,"updated_by"=$15 -WHERE "id" = $16`). - WithArgs("foo", "bar", nil, "baz", AnyArgument{}, "repo", nil, nil, 1, false, false, 1, "user", AnyArgument{}, "user2", 1). +SET "org"=$1,"repo"=$2,"team"=$3,"name"=$4,"value"=$5,"type"=$6,"images"=$7,"allow_events"=$8,"allow_command"=$9,"allow_substitution"=$10,"created_at"=$11,"created_by"=$12,"updated_at"=$13,"updated_by"=$14 +WHERE "id" = $15`). + WithArgs("foo", "bar", nil, "baz", AnyArgument{}, "repo", nil, 1, false, false, 1, "user", AnyArgument{}, "user2", 1). WillReturnResult(sqlmock.NewResult(1, 1)) // ensure the mock expects the org query _mock.ExpectExec(`UPDATE "secrets" -SET "org"=$1,"repo"=$2,"team"=$3,"name"=$4,"value"=$5,"type"=$6,"images"=$7,"events"=$8,"allow_events"=$9,"allow_command"=$10,"allow_substitution"=$11,"created_at"=$12,"created_by"=$13,"updated_at"=$14,"updated_by"=$15 -WHERE "id" = $16`). - WithArgs("foo", "*", nil, "bar", AnyArgument{}, "org", nil, nil, 1, false, false, 1, "user", AnyArgument{}, "user2", 2). +SET "org"=$1,"repo"=$2,"team"=$3,"name"=$4,"value"=$5,"type"=$6,"images"=$7,"allow_events"=$8,"allow_command"=$9,"allow_substitution"=$10,"created_at"=$11,"created_by"=$12,"updated_at"=$13,"updated_by"=$14 +WHERE "id" = $15`). + WithArgs("foo", "*", nil, "bar", AnyArgument{}, "org", nil, 1, false, false, 1, "user", AnyArgument{}, "user2", 2). WillReturnResult(sqlmock.NewResult(1, 1)) // ensure the mock expects the shared query _mock.ExpectExec(`UPDATE "secrets" -SET "org"=$1,"repo"=$2,"team"=$3,"name"=$4,"value"=$5,"type"=$6,"images"=$7,"events"=$8,"allow_events"=$9,"allow_command"=$10,"allow_substitution"=$11,"created_at"=$12,"created_by"=$13,"updated_at"=$14,"updated_by"=$15 -WHERE "id" = $16`). - WithArgs("foo", nil, "bar", "baz", AnyArgument{}, "shared", nil, nil, 1, false, false, 1, "user", NowTimestamp{}, "user2", 3). +SET "org"=$1,"repo"=$2,"team"=$3,"name"=$4,"value"=$5,"type"=$6,"images"=$7,"allow_events"=$8,"allow_command"=$9,"allow_substitution"=$10,"created_at"=$11,"created_by"=$12,"updated_at"=$13,"updated_by"=$14 +WHERE "id" = $15`). + WithArgs("foo", nil, "bar", "baz", AnyArgument{}, "shared", nil, 1, false, false, 1, "user", NowTimestamp{}, "user2", 3). WillReturnResult(sqlmock.NewResult(1, 1)) _sqlite := testSqlite(t) diff --git a/go.mod b/go.mod index eb4191a8d..681104cdc 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/drone/envsubst v1.0.3 github.com/gin-gonic/gin v1.9.1 github.com/go-playground/assert/v2 v2.2.0 - github.com/go-vela/types v0.23.4-0.20240326211542-476edfa844f0 + github.com/go-vela/types v0.23.4-0.20240401132228-9b43c701ab32 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v59 v59.0.0 diff --git a/go.sum b/go.sum index 7e6377fa8..a956a83fd 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-vela/types v0.23.4-0.20240326211542-476edfa844f0 h1:CR/lM4nzDoQ1wKDa9aJGnlZHkx94m170t9NKyCjV9NA= -github.com/go-vela/types v0.23.4-0.20240326211542-476edfa844f0/go.mod h1:mEF9dLkk00rUXf/t39n2WvXZgJbxnPEEWy+DHqIlRUo= +github.com/go-vela/types v0.23.4-0.20240401132228-9b43c701ab32 h1:fqmNnM1LdH3Zg1zCADfgR7a51EOSZvLFAB2Em4CG+Pg= +github.com/go-vela/types v0.23.4-0.20240401132228-9b43c701ab32/go.mod h1:mEF9dLkk00rUXf/t39n2WvXZgJbxnPEEWy+DHqIlRUo= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= diff --git a/mock/server/repo.go b/mock/server/repo.go index cc480b289..88b4d4715 100644 --- a/mock/server/repo.go +++ b/mock/server/repo.go @@ -33,11 +33,6 @@ const ( "pipeline_type": "yaml", "topics": [], "active": true, - "allow_pull": false, - "allow_push": true, - "allow_deploy": false, - "allow_tag": false, - "allow_comment": false, "allow_events": { "push": { "branch": true, @@ -77,11 +72,7 @@ const ( "visibility": "public", "private": false, "trusted": true, - "active": true, - "allow_pr": false, - "allow_push": true, - "allow_deploy": false, - "allow_tag": false + "active": true }, { "id": 2, @@ -97,11 +88,7 @@ const ( "visibility": "public", "private": false, "trusted": true, - "active": true, - "allow_pr": false, - "allow_push": true, - "allow_deploy": false, - "allow_tag": false + "active": true } ]` ) diff --git a/mock/server/secret.go b/mock/server/secret.go index 34fcd4b76..5030ce3cd 100644 --- a/mock/server/secret.go +++ b/mock/server/secret.go @@ -28,7 +28,6 @@ const ( "images": [ "alpine" ], - "events": [], "allow_events": { "push": { "branch": true, @@ -68,9 +67,6 @@ const ( "type": "repo", "images": [ "alpine" - ], - "events": [ - "push" ] }, { @@ -83,9 +79,6 @@ const ( "type": "org", "images": [ "alpine" - ], - "events": [ - "push" ] }, { @@ -98,9 +91,6 @@ const ( "type": "shared", "images": [ "alpine" - ], - "events": [ - "push" ] } ]` diff --git a/queue/redis/redis_test.go b/queue/redis/redis_test.go index 919892976..3f632b129 100644 --- a/queue/redis/redis_test.go +++ b/queue/redis/redis_test.go @@ -74,22 +74,18 @@ var ( } _repo = &library.Repo{ - ID: Int64(1), - Org: String("github"), - Name: String("octocat"), - FullName: String("github/octocat"), - Link: String("https://github.com/github/octocat"), - Clone: String("https://github.com/github/octocat.git"), - Branch: String("main"), - Timeout: Int64(60), - Visibility: String("public"), - Private: Bool(false), - Trusted: Bool(false), - Active: Bool(true), - AllowPull: Bool(false), - AllowPush: Bool(true), - AllowDeploy: Bool(false), - AllowTag: Bool(false), + ID: Int64(1), + Org: String("github"), + Name: String("octocat"), + FullName: String("github/octocat"), + Link: String("https://github.com/github/octocat"), + Clone: String("https://github.com/github/octocat.git"), + Branch: String("main"), + Timeout: Int64(60), + Visibility: String("public"), + Private: Bool(false), + Trusted: Bool(false), + Active: Bool(true), } _steps = &pipeline.Build{ diff --git a/router/middleware/org/org_test.go b/router/middleware/org/org_test.go index 27021222f..8b217f5f8 100644 --- a/router/middleware/org/org_test.go +++ b/router/middleware/org/org_test.go @@ -48,11 +48,6 @@ func TestOrg_Establish(t *testing.T) { r.SetPrivate(false) r.SetTrusted(false) r.SetActive(false) - r.SetAllowPull(false) - r.SetAllowPush(false) - r.SetAllowDeploy(false) - r.SetAllowTag(false) - r.SetAllowComment(false) want := "foo" got := "" diff --git a/router/middleware/repo/repo_test.go b/router/middleware/repo/repo_test.go index 9ae835eae..488bcac8d 100644 --- a/router/middleware/repo/repo_test.go +++ b/router/middleware/repo/repo_test.go @@ -54,11 +54,6 @@ func TestRepo_Establish(t *testing.T) { want.SetPrivate(false) want.SetTrusted(false) want.SetActive(false) - want.SetAllowPull(false) - want.SetAllowPush(false) - want.SetAllowDeploy(false) - want.SetAllowTag(false) - want.SetAllowComment(false) want.SetAllowEvents(library.NewEventsFromMask(1)) want.SetPipelineType("yaml") want.SetPreviousName("") diff --git a/scm/github/repo_test.go b/scm/github/repo_test.go index 6918c8a0d..b34e704ac 100644 --- a/scm/github/repo_test.go +++ b/scm/github/repo_test.go @@ -690,9 +690,6 @@ func TestGithub_Enable(t *testing.T) { r.SetName("bar") r.SetOrg("foo") r.SetHash("secret") - r.SetAllowPush(true) - r.SetAllowPull(true) - r.SetAllowDeploy(true) client, _ := NewTest(s.URL) @@ -739,9 +736,6 @@ func TestGithub_Update(t *testing.T) { r.SetName("bar") r.SetOrg("foo") r.SetHash("secret") - r.SetAllowPush(true) - r.SetAllowPull(true) - r.SetAllowDeploy(true) hookID := int64(1) diff --git a/secret/native/count_test.go b/secret/native/count_test.go index 33ab448be..e080ec03a 100644 --- a/secret/native/count_test.go +++ b/secret/native/count_test.go @@ -20,7 +20,6 @@ func TestNative_Count(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetCreatedAt(1) sec.SetUpdatedAt(1) diff --git a/secret/native/create_test.go b/secret/native/create_test.go index 02a114976..c7c44c22d 100644 --- a/secret/native/create_test.go +++ b/secret/native/create_test.go @@ -22,7 +22,6 @@ func TestNative_Create_Org(t *testing.T) { want.SetValue("baz") want.SetType("org") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowEvents(library.NewEventsFromMask(1)) want.SetAllowCommand(false) want.SetAllowSubstitution(false) @@ -71,7 +70,6 @@ func TestNative_Create_Repo(t *testing.T) { want.SetValue("foob") want.SetType("repo") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowEvents(library.NewEventsFromMask(1)) want.SetAllowCommand(false) want.SetAllowSubstitution(false) @@ -120,7 +118,6 @@ func TestNative_Create_Shared(t *testing.T) { want.SetValue("foob") want.SetType("shared") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowEvents(library.NewEventsFromMask(1)) want.SetAllowCommand(false) want.SetAllowSubstitution(false) @@ -169,7 +166,6 @@ func TestNative_Create_Invalid(t *testing.T) { sec.SetValue("foob") sec.SetType("invalid") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowEvents(library.NewEventsFromMask(1)) sec.SetAllowCommand(false) sec.SetAllowSubstitution(false) diff --git a/secret/native/delete_test.go b/secret/native/delete_test.go index 96838d575..ad486b2a1 100644 --- a/secret/native/delete_test.go +++ b/secret/native/delete_test.go @@ -21,7 +21,6 @@ func TestNative_Delete(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) sec.SetCreatedAt(1) sec.SetUpdatedAt(1) diff --git a/secret/native/get_test.go b/secret/native/get_test.go index b9b56e51e..f20dcdf5b 100644 --- a/secret/native/get_test.go +++ b/secret/native/get_test.go @@ -22,7 +22,6 @@ func TestNative_Get(t *testing.T) { want.SetValue("foob") want.SetType("repo") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowEvents(library.NewEventsFromMask(1)) want.SetAllowCommand(false) want.SetAllowSubstitution(false) diff --git a/secret/native/list_test.go b/secret/native/list_test.go index b01e3a546..b201eda73 100644 --- a/secret/native/list_test.go +++ b/secret/native/list_test.go @@ -22,7 +22,6 @@ func TestNative_List(t *testing.T) { sOne.SetValue("foob") sOne.SetType("repo") sOne.SetImages([]string{"foo", "bar"}) - sOne.SetEvents([]string{"foo", "bar"}) sOne.SetAllowEvents(library.NewEventsFromMask(1)) sOne.SetAllowCommand(false) sOne.SetAllowSubstitution(false) @@ -40,7 +39,6 @@ func TestNative_List(t *testing.T) { sTwo.SetValue("baz") sTwo.SetType("repo") sTwo.SetImages([]string{"foo", "bar"}) - sTwo.SetEvents([]string{"foo", "bar"}) sTwo.SetAllowEvents(library.NewEventsFromMask(1)) sTwo.SetAllowCommand(false) sTwo.SetAllowSubstitution(false) diff --git a/secret/native/update.go b/secret/native/update.go index 7e2c92d0c..bce00e936 100644 --- a/secret/native/update.go +++ b/secret/native/update.go @@ -19,11 +19,6 @@ func (c *client) Update(ctx context.Context, sType, org, name string, s *library return nil, err } - // update the events if set - if len(s.GetEvents()) > 0 { - secret.SetEvents(s.GetEvents()) - } - // update allow events if set if s.GetAllowEvents().ToDatabase() > 0 { secret.SetAllowEvents(s.GetAllowEvents()) diff --git a/secret/native/update_test.go b/secret/native/update_test.go index 38d7a3b5b..1ec2d597a 100644 --- a/secret/native/update_test.go +++ b/secret/native/update_test.go @@ -23,7 +23,6 @@ func TestNative_Update(t *testing.T) { original.SetValue("secretValue") original.SetType("repo") original.SetImages([]string{"foo", "baz"}) - original.SetEvents([]string{"foob", "bar"}) original.SetAllowEvents(library.NewEventsFromMask(1)) original.SetAllowCommand(true) original.SetAllowSubstitution(true) @@ -41,7 +40,6 @@ func TestNative_Update(t *testing.T) { want.SetValue("foob") want.SetType("repo") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowEvents(library.NewEventsFromMask(3)) want.SetAllowCommand(false) want.SetAllowSubstitution(false) diff --git a/secret/vault/create_test.go b/secret/vault/create_test.go index 129b0e487..dc0d5226f 100644 --- a/secret/vault/create_test.go +++ b/secret/vault/create_test.go @@ -51,7 +51,6 @@ func TestVault_Create_Org(t *testing.T) { sec.SetValue("baz") sec.SetType("org") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(true) sec.SetAllowSubstitution(true) sec.SetAllowEvents(library.NewEventsFromMask(1)) @@ -142,7 +141,6 @@ func TestVault_Create_Repo(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(true) sec.SetAllowSubstitution(true) sec.SetAllowEvents(library.NewEventsFromMask(3)) @@ -234,7 +232,6 @@ func TestVault_Create_Shared(t *testing.T) { sec.SetValue("foob") sec.SetType("shared") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) sec.SetAllowSubstitution(false) sec.SetAllowEvents(library.NewEventsFromMask(1)) @@ -321,7 +318,6 @@ func TestVault_Create_InvalidSecret(t *testing.T) { sec.SetValue("") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) type args struct { @@ -376,7 +372,6 @@ func TestVault_Create_InvalidType(t *testing.T) { sec.SetValue("foob") sec.SetType("invalid") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) // setup mock server @@ -430,7 +425,6 @@ func TestVault_Create_ClosedServer(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) // setup mock server diff --git a/secret/vault/get_test.go b/secret/vault/get_test.go index 2c811e9fd..5af08f22a 100644 --- a/secret/vault/get_test.go +++ b/secret/vault/get_test.go @@ -51,7 +51,6 @@ func TestVault_Get_Org(t *testing.T) { want.SetValue("baz") want.SetType("org") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowCommand(true) want.SetAllowSubstitution(true) want.SetAllowEvents(library.NewEventsFromMask(1)) @@ -142,7 +141,6 @@ func TestVault_Get_Repo(t *testing.T) { want.SetValue("foob") want.SetType("repo") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowCommand(true) want.SetAllowSubstitution(true) want.SetAllowEvents(library.NewEventsFromMask(3)) @@ -233,7 +231,6 @@ func TestVault_Get_Shared(t *testing.T) { want.SetValue("foob") want.SetType("shared") want.SetImages([]string{"foo", "bar"}) - want.SetEvents([]string{"foo", "bar"}) want.SetAllowCommand(false) want.SetAllowSubstitution(false) want.SetAllowEvents(library.NewEventsFromMask(1)) diff --git a/secret/vault/list_test.go b/secret/vault/list_test.go index 3a6c2ab60..9a6eb352e 100644 --- a/secret/vault/list_test.go +++ b/secret/vault/list_test.go @@ -66,7 +66,6 @@ func TestVault_List_Org(t *testing.T) { sec.SetValue("baz") sec.SetType("org") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(true) sec.SetAllowSubstitution(true) sec.SetAllowEvents(library.NewEventsFromMask(1)) @@ -204,7 +203,6 @@ func TestVault_List_Repo(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(true) sec.SetAllowSubstitution(true) sec.SetAllowEvents(library.NewEventsFromMask(3)) @@ -327,7 +325,6 @@ func TestVault_List_Shared(t *testing.T) { sec.SetValue("foob") sec.SetType("shared") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) sec.SetAllowSubstitution(false) sec.SetAllowEvents(library.NewEventsFromMask(1)) diff --git a/secret/vault/update.go b/secret/vault/update.go index 5655dcb9d..a269bd8f3 100644 --- a/secret/vault/update.go +++ b/secret/vault/update.go @@ -45,9 +45,6 @@ func (c *client) Update(ctx context.Context, sType, org, name string, s *library // convert the Vault secret our secret vault := vaultFromSecret(sec) - if len(s.GetEvents()) > 0 { - vault.Data["events"] = s.GetEvents() - } if s.GetAllowEvents().ToDatabase() != 0 { vault.Data["allow_events"] = s.GetAllowEvents().ToDatabase() diff --git a/secret/vault/update_test.go b/secret/vault/update_test.go index 94f247c7e..4a525c1ab 100644 --- a/secret/vault/update_test.go +++ b/secret/vault/update_test.go @@ -66,7 +66,6 @@ func TestVault_Update_Org(t *testing.T) { sec.SetValue("baz") sec.SetType("org") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(true) sec.SetAllowSubstitution(true) sec.SetAllowEvents(library.NewEventsFromMask(1)) @@ -173,7 +172,6 @@ func TestVault_Update_Repo(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(true) sec.SetAllowSubstitution(true) sec.SetAllowEvents(library.NewEventsFromMask(3)) @@ -280,7 +278,6 @@ func TestVault_Update_Shared(t *testing.T) { sec.SetValue("foob") sec.SetType("shared") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) sec.SetAllowSubstitution(false) sec.SetAllowEvents(library.NewEventsFromMask(1)) @@ -372,7 +369,6 @@ func TestVault_Update_InvalidSecret(t *testing.T) { sec.SetValue("") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) sec.SetAllowCommand(false) type args struct { @@ -426,7 +422,6 @@ func TestVault_Update_InvalidType(t *testing.T) { sec.SetValue("foob") sec.SetType("invalid") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) // setup mock server fake := httptest.NewServer(http.NotFoundHandler()) @@ -478,7 +473,6 @@ func TestVault_Update_ClosedServer(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) // setup mock server fake := httptest.NewServer(http.NotFoundHandler()) @@ -552,7 +546,6 @@ func TestVault_Update_NoWrite(t *testing.T) { sec.SetValue("foob") sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) - sec.SetEvents([]string{"foo", "bar"}) type args struct { version string diff --git a/secret/vault/vault.go b/secret/vault/vault.go index d9f3d79b5..2cbf34b34 100644 --- a/secret/vault/vault.go +++ b/secret/vault/vault.go @@ -144,22 +144,8 @@ func secretFromVault(vault *api.Secret) *library.Secret { data = vault.Data } - // set events if found in Vault secret - v, ok := data["events"] - if ok { - events, ok := v.([]interface{}) - if ok { - for _, element := range events { - event, ok := element.(string) - if ok { - s.SetEvents(append(s.GetEvents(), event)) - } - } - } - } - // set allow_events if found in Vault secret - v, ok = data["allow_events"] + v, ok := data["allow_events"] if ok { maskJSON, ok := v.(json.Number) if ok { @@ -345,11 +331,6 @@ func vaultFromSecret(s *library.Secret) *api.Secret { vault := new(api.Secret) vault.Data = data - // set events if found in Vela secret - if len(s.GetEvents()) > 0 { - vault.Data["events"] = s.GetEvents() - } - // set allow events to mask if s.GetAllowEvents().ToDatabase() != 0 { vault.Data["allow_events"] = s.GetAllowEvents().ToDatabase() diff --git a/secret/vault/vault_test.go b/secret/vault/vault_test.go index cec5d02c8..2bbb666bb 100644 --- a/secret/vault/vault_test.go +++ b/secret/vault/vault_test.go @@ -133,7 +133,6 @@ func TestVault_secretFromVault(t *testing.T) { want.SetName("bar") want.SetValue("baz") want.SetType("org") - want.SetEvents([]string{"push", "tag", "deployment"}) want.SetAllowEvents(library.NewEventsFromMask(8195)) want.SetImages([]string{"foo", "bar"}) want.SetAllowCommand(true) @@ -176,7 +175,6 @@ func TestVault_vaultFromSecret(t *testing.T) { s.SetName("bar") s.SetValue("baz") s.SetType("org") - s.SetEvents([]string{"foo", "bar"}) s.SetAllowEvents(library.NewEventsFromMask(1)) s.SetImages([]string{"foo", "bar"}) s.SetAllowCommand(true) @@ -188,7 +186,6 @@ func TestVault_vaultFromSecret(t *testing.T) { want := &api.Secret{ Data: map[string]interface{}{ - "events": []string{"foo", "bar"}, "allow_events": int64(1), "images": []string{"foo", "bar"}, "name": "bar", @@ -243,7 +240,6 @@ func TestVault_AccurateSecretFields(t *testing.T) { // helper function to return a test Vault secret data. func testVaultSecretData() map[string]interface{} { return map[string]interface{}{ - "events": []interface{}{"push", "tag", "deployment"}, "allow_events": json.Number("8195"), "images": []interface{}{"foo", "bar"}, "name": "bar",