mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-08 03:40:28 -07:00
Co-authored-by: upodroid <cy@borg.dev> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: upodroid <cy@borg.dev>
This commit is contained in:
parent
0abe246128
commit
4b8faad30b
2 changed files with 277 additions and 0 deletions
|
@ -162,6 +162,73 @@ options:
|
||||||
SHA must be provided.
|
SHA must be provided.
|
||||||
required: false
|
required: false
|
||||||
type: str
|
type: str
|
||||||
|
github:
|
||||||
|
description:
|
||||||
|
- Describes the configuration of a trigger that creates a build whenever a GitHub
|
||||||
|
event is received.
|
||||||
|
required: false
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
owner:
|
||||||
|
description:
|
||||||
|
- 'Owner of the repository. For example: The owner for U(https://github.com/googlecloudplatform/cloud-builders)
|
||||||
|
is "googlecloudplatform".'
|
||||||
|
required: false
|
||||||
|
type: str
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- 'Name of the repository. For example: The name for U(https://github.com/googlecloudplatform/cloud-builders)
|
||||||
|
is "cloud-builders".'
|
||||||
|
required: false
|
||||||
|
type: str
|
||||||
|
pull_request:
|
||||||
|
description:
|
||||||
|
- filter to match changes in pull requests. Specify only one of pullRequest
|
||||||
|
or push.
|
||||||
|
required: false
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
branch:
|
||||||
|
description:
|
||||||
|
- Regex of branches to match.
|
||||||
|
required: true
|
||||||
|
type: str
|
||||||
|
comment_control:
|
||||||
|
description:
|
||||||
|
- Whether to block builds on a "/gcbrun" comment from a repository owner
|
||||||
|
or collaborator.
|
||||||
|
- 'Some valid choices include: "COMMENTS_DISABLED", "COMMENTS_ENABLED",
|
||||||
|
"COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY"'
|
||||||
|
required: false
|
||||||
|
type: str
|
||||||
|
invert_regex:
|
||||||
|
description:
|
||||||
|
- If true, branches that do NOT match the git_ref will trigger a build.
|
||||||
|
required: false
|
||||||
|
type: bool
|
||||||
|
push:
|
||||||
|
description:
|
||||||
|
- filter to match changes in refs, like branches or tags. Specify only one
|
||||||
|
of pullRequest or push.
|
||||||
|
required: false
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
invert_regex:
|
||||||
|
description:
|
||||||
|
- When true, only trigger a build if the revision regex does NOT match
|
||||||
|
the git_ref regex.
|
||||||
|
required: false
|
||||||
|
type: bool
|
||||||
|
branch:
|
||||||
|
description:
|
||||||
|
- Regex of branches to match. Specify only one of branch or tag.
|
||||||
|
required: false
|
||||||
|
type: str
|
||||||
|
tag:
|
||||||
|
description:
|
||||||
|
- Regex of tags to match. Specify only one of branch or tag.
|
||||||
|
required: false
|
||||||
|
type: str
|
||||||
build:
|
build:
|
||||||
description:
|
description:
|
||||||
- Contents of the build template. Either a filename or build template must be
|
- Contents of the build template. Either a filename or build template must be
|
||||||
|
@ -811,6 +878,71 @@ triggerTemplate:
|
||||||
SHA must be provided.
|
SHA must be provided.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
|
github:
|
||||||
|
description:
|
||||||
|
- Describes the configuration of a trigger that creates a build whenever a GitHub
|
||||||
|
event is received.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
owner:
|
||||||
|
description:
|
||||||
|
- 'Owner of the repository. For example: The owner for U(https://github.com/googlecloudplatform/cloud-builders)
|
||||||
|
is "googlecloudplatform".'
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- 'Name of the repository. For example: The name for U(https://github.com/googlecloudplatform/cloud-builders)
|
||||||
|
is "cloud-builders".'
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
pullRequest:
|
||||||
|
description:
|
||||||
|
- filter to match changes in pull requests. Specify only one of pullRequest
|
||||||
|
or push.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
branch:
|
||||||
|
description:
|
||||||
|
- Regex of branches to match.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
commentControl:
|
||||||
|
description:
|
||||||
|
- Whether to block builds on a "/gcbrun" comment from a repository owner
|
||||||
|
or collaborator.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
invertRegex:
|
||||||
|
description:
|
||||||
|
- If true, branches that do NOT match the git_ref will trigger a build.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
push:
|
||||||
|
description:
|
||||||
|
- filter to match changes in refs, like branches or tags. Specify only one of
|
||||||
|
pullRequest or push.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
invertRegex:
|
||||||
|
description:
|
||||||
|
- When true, only trigger a build if the revision regex does NOT match the
|
||||||
|
git_ref regex.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
branch:
|
||||||
|
description:
|
||||||
|
- Regex of branches to match. Specify only one of branch or tag.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
tag:
|
||||||
|
description:
|
||||||
|
- Regex of tags to match. Specify only one of branch or tag.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
build:
|
build:
|
||||||
description:
|
description:
|
||||||
- Contents of the build template. Either a filename or build template must be provided.
|
- Contents of the build template. Either a filename or build template must be provided.
|
||||||
|
@ -1308,6 +1440,17 @@ def main():
|
||||||
commit_sha=dict(type='str'),
|
commit_sha=dict(type='str'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
github=dict(
|
||||||
|
type='dict',
|
||||||
|
options=dict(
|
||||||
|
owner=dict(type='str'),
|
||||||
|
name=dict(type='str'),
|
||||||
|
pull_request=dict(
|
||||||
|
type='dict', options=dict(branch=dict(required=True, type='str'), comment_control=dict(type='str'), invert_regex=dict(type='bool'))
|
||||||
|
),
|
||||||
|
push=dict(type='dict', options=dict(invert_regex=dict(type='bool'), branch=dict(type='str'), tag=dict(type='str'))),
|
||||||
|
),
|
||||||
|
),
|
||||||
build=dict(
|
build=dict(
|
||||||
type='dict',
|
type='dict',
|
||||||
options=dict(
|
options=dict(
|
||||||
|
@ -1446,6 +1589,7 @@ def resource_to_request(module):
|
||||||
u'ignoredFiles': module.params.get('ignored_files'),
|
u'ignoredFiles': module.params.get('ignored_files'),
|
||||||
u'includedFiles': module.params.get('included_files'),
|
u'includedFiles': module.params.get('included_files'),
|
||||||
u'triggerTemplate': TriggerTriggertemplate(module.params.get('trigger_template', {}), module).to_request(),
|
u'triggerTemplate': TriggerTriggertemplate(module.params.get('trigger_template', {}), module).to_request(),
|
||||||
|
u'github': TriggerGithub(module.params.get('github', {}), module).to_request(),
|
||||||
u'build': TriggerBuild(module.params.get('build', {}), module).to_request(),
|
u'build': TriggerBuild(module.params.get('build', {}), module).to_request(),
|
||||||
}
|
}
|
||||||
return_vals = {}
|
return_vals = {}
|
||||||
|
@ -1523,6 +1667,7 @@ def response_to_hash(module, response):
|
||||||
u'ignoredFiles': response.get(u'ignoredFiles'),
|
u'ignoredFiles': response.get(u'ignoredFiles'),
|
||||||
u'includedFiles': response.get(u'includedFiles'),
|
u'includedFiles': response.get(u'includedFiles'),
|
||||||
u'triggerTemplate': TriggerTriggertemplate(response.get(u'triggerTemplate', {}), module).from_response(),
|
u'triggerTemplate': TriggerTriggertemplate(response.get(u'triggerTemplate', {}), module).from_response(),
|
||||||
|
u'github': TriggerGithub(response.get(u'github', {}), module).from_response(),
|
||||||
u'build': TriggerBuild(response.get(u'build', {}), module).from_response(),
|
u'build': TriggerBuild(response.get(u'build', {}), module).from_response(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1562,6 +1707,73 @@ class TriggerTriggertemplate(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TriggerGithub(object):
|
||||||
|
def __init__(self, request, module):
|
||||||
|
self.module = module
|
||||||
|
if request:
|
||||||
|
self.request = request
|
||||||
|
else:
|
||||||
|
self.request = {}
|
||||||
|
|
||||||
|
def to_request(self):
|
||||||
|
return remove_nones_from_dict(
|
||||||
|
{
|
||||||
|
u'owner': self.request.get('owner'),
|
||||||
|
u'name': self.request.get('name'),
|
||||||
|
u'pullRequest': TriggerPullrequest(self.request.get('pull_request', {}), self.module).to_request(),
|
||||||
|
u'push': TriggerPush(self.request.get('push', {}), self.module).to_request(),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def from_response(self):
|
||||||
|
return remove_nones_from_dict(
|
||||||
|
{
|
||||||
|
u'owner': self.request.get(u'owner'),
|
||||||
|
u'name': self.request.get(u'name'),
|
||||||
|
u'pullRequest': TriggerPullrequest(self.request.get(u'pullRequest', {}), self.module).from_response(),
|
||||||
|
u'push': TriggerPush(self.request.get(u'push', {}), self.module).from_response(),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TriggerPullrequest(object):
|
||||||
|
def __init__(self, request, module):
|
||||||
|
self.module = module
|
||||||
|
if request:
|
||||||
|
self.request = request
|
||||||
|
else:
|
||||||
|
self.request = {}
|
||||||
|
|
||||||
|
def to_request(self):
|
||||||
|
return remove_nones_from_dict(
|
||||||
|
{u'branch': self.request.get('branch'), u'commentControl': self.request.get('comment_control'), u'invertRegex': self.request.get('invert_regex')}
|
||||||
|
)
|
||||||
|
|
||||||
|
def from_response(self):
|
||||||
|
return remove_nones_from_dict(
|
||||||
|
{u'branch': self.request.get(u'branch'), u'commentControl': self.request.get(u'commentControl'), u'invertRegex': self.request.get(u'invertRegex')}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TriggerPush(object):
|
||||||
|
def __init__(self, request, module):
|
||||||
|
self.module = module
|
||||||
|
if request:
|
||||||
|
self.request = request
|
||||||
|
else:
|
||||||
|
self.request = {}
|
||||||
|
|
||||||
|
def to_request(self):
|
||||||
|
return remove_nones_from_dict(
|
||||||
|
{u'invertRegex': self.request.get('invert_regex'), u'branch': self.request.get('branch'), u'tag': self.request.get('tag')}
|
||||||
|
)
|
||||||
|
|
||||||
|
def from_response(self):
|
||||||
|
return remove_nones_from_dict(
|
||||||
|
{u'invertRegex': self.request.get(u'invertRegex'), u'branch': self.request.get(u'branch'), u'tag': self.request.get(u'tag')}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TriggerBuild(object):
|
class TriggerBuild(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
|
|
|
@ -223,6 +223,71 @@ resources:
|
||||||
SHA must be provided.
|
SHA must be provided.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
|
github:
|
||||||
|
description:
|
||||||
|
- Describes the configuration of a trigger that creates a build whenever a GitHub
|
||||||
|
event is received.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
owner:
|
||||||
|
description:
|
||||||
|
- 'Owner of the repository. For example: The owner for U(https://github.com/googlecloudplatform/cloud-builders)
|
||||||
|
is "googlecloudplatform".'
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- 'Name of the repository. For example: The name for U(https://github.com/googlecloudplatform/cloud-builders)
|
||||||
|
is "cloud-builders".'
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
pullRequest:
|
||||||
|
description:
|
||||||
|
- filter to match changes in pull requests. Specify only one of pullRequest
|
||||||
|
or push.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
branch:
|
||||||
|
description:
|
||||||
|
- Regex of branches to match.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
commentControl:
|
||||||
|
description:
|
||||||
|
- Whether to block builds on a "/gcbrun" comment from a repository owner
|
||||||
|
or collaborator.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
invertRegex:
|
||||||
|
description:
|
||||||
|
- If true, branches that do NOT match the git_ref will trigger a build.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
push:
|
||||||
|
description:
|
||||||
|
- filter to match changes in refs, like branches or tags. Specify only one
|
||||||
|
of pullRequest or push.
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
invertRegex:
|
||||||
|
description:
|
||||||
|
- When true, only trigger a build if the revision regex does NOT match
|
||||||
|
the git_ref regex.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
branch:
|
||||||
|
description:
|
||||||
|
- Regex of branches to match. Specify only one of branch or tag.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
tag:
|
||||||
|
description:
|
||||||
|
- Regex of tags to match. Specify only one of branch or tag.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
build:
|
build:
|
||||||
description:
|
description:
|
||||||
- Contents of the build template. Either a filename or build template must be
|
- Contents of the build template. Either a filename or build template must be
|
||||||
|
|
Loading…
Add table
Reference in a new issue