Class: Google::Apis::CloudbuildV1::BuildTrigger

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/cloudbuild_v1/classes.rb,
lib/google/apis/cloudbuild_v1/representations.rb,
lib/google/apis/cloudbuild_v1/representations.rb

Overview

Configuration for an automated build in response to source repository changes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ BuildTrigger

Returns a new instance of BuildTrigger.



904
905
906
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 904

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#approval_configGoogle::Apis::CloudbuildV1::ApprovalConfig

ApprovalConfig describes configuration for manual approval of a build. Corresponds to the JSON property approvalConfig



751
752
753
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 751

def approval_config
  @approval_config
end

#autodetectBoolean Also known as: autodetect?

Autodetect build configuration. The following precedence is used (case insensitive): 1. cloudbuild.yaml 2. cloudbuild.yml 3. cloudbuild.json 4. Dockerfile Currently only available for GitHub App Triggers. Corresponds to the JSON property autodetect

Returns:

  • (Boolean)


758
759
760
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 758

def autodetect
  @autodetect
end

#buildGoogle::Apis::CloudbuildV1::Build

A build resource in the Cloud Build API. At a high level, a Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created: - $ PROJECT_ID: the project ID of the build. - $PROJECT_NUMBER: the project number of the build. - $LOCATION: the location/region of the build. - $BUILD_ID: the autogenerated ID of the build. - $REPO_NAME: the source repository name specified by RepoSource. - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag. - $SHORT_SHA: first 7 characters of $REVISION_ID or $ COMMIT_SHA. Corresponds to the JSON property build



775
776
777
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 775

def build
  @build
end

#create_timeString

Output only. Time when the trigger was created. Corresponds to the JSON property createTime

Returns:

  • (String)


780
781
782
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 780

def create_time
  @create_time
end

#descriptionString

Human-readable description of this trigger. Corresponds to the JSON property description

Returns:

  • (String)


785
786
787
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 785

def description
  @description
end

#disabledBoolean Also known as: disabled?

If true, the trigger will never automatically execute a build. Corresponds to the JSON property disabled

Returns:

  • (Boolean)


790
791
792
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 790

def disabled
  @disabled
end

#event_typeString

Optional. EventType allows the user to explicitly set the type of event to which this BuildTrigger should respond. This field is optional but will be validated against the rest of the configuration if it is set. Corresponds to the JSON property eventType

Returns:

  • (String)


798
799
800
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 798

def event_type
  @event_type
end

#filenameString

Path, from the source root, to the build configuration file (i.e. cloudbuild. yaml). Corresponds to the JSON property filename

Returns:

  • (String)


804
805
806
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 804

def filename
  @filename
end

#filterString

A Common Expression Language string. Corresponds to the JSON property filter

Returns:

  • (String)


809
810
811
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 809

def filter
  @filter
end

#git_file_sourceGoogle::Apis::CloudbuildV1::GitFileSource

GitFileSource describes a file within a (possibly remote) code repository. Corresponds to the JSON property gitFileSource



814
815
816
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 814

def git_file_source
  @git_file_source
end

#githubGoogle::Apis::CloudbuildV1::GitHubEventsConfig

GitHubEventsConfig describes the configuration of a trigger that creates a build whenever a GitHub event is received. Corresponds to the JSON property github



820
821
822
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 820

def github
  @github
end

#idString

Output only. Unique identifier of the trigger. Corresponds to the JSON property id

Returns:

  • (String)


825
826
827
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 825

def id
  @id
end

#ignored_filesArray<String>

ignored_files and included_files are file glob matches using https://golang. org/pkg/path/filepath/#Match extended with support for "**". If ignored_files and changed files are both empty, then they are not used to determine whether or not to trigger a build. If ignored_files is not empty, then we ignore any files that match any of the ignored_file globs. If the change has no files that are outside of the ignored_files globs, then we do not trigger a build. Corresponds to the JSON property ignoredFiles

Returns:

  • (Array<String>)


835
836
837
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 835

def ignored_files
  @ignored_files
end

#included_filesArray<String>

If any of the files altered in the commit pass the ignored_files filter and included_files is empty, then as far as this filter is concerned, we should trigger the build. If any of the files altered in the commit pass the ignored_files filter and included_files is not empty, then we make sure that at least one of those files matches a included_files glob. If not, then we do not trigger a build. Corresponds to the JSON property includedFiles

Returns:

  • (Array<String>)


845
846
847
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 845

def included_files
  @included_files
end

#nameString

User-assigned name of the trigger. Must be unique within the project. Trigger names must meet the following requirements: + They must contain only alphanumeric characters and dashes. + They can be 1-64 characters long. + They must begin and end with an alphanumeric character. Corresponds to the JSON property name

Returns:

  • (String)


853
854
855
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 853

def name
  @name
end

#pubsub_configGoogle::Apis::CloudbuildV1::PubsubConfig

PubsubConfig describes the configuration of a trigger that creates a build whenever a Pub/Sub message is published. Corresponds to the JSON property pubsubConfig



859
860
861
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 859

def pubsub_config
  @pubsub_config
end

#resource_nameString

The Trigger name with format: projects/project/locations/location/ triggers/trigger`, wheretriggeris a unique identifier generated by the service. Corresponds to the JSON propertyresourceName`

Returns:

  • (String)


866
867
868
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 866

def resource_name
  @resource_name
end

#service_accountString

The service account used for all user-controlled operations including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. If no service account is set, then the standard Cloud Build service account ([ PROJECT_NUM]@system.gserviceaccount.com) will be used instead. Format: projects/PROJECT_ID/serviceAccounts/ACCOUNT_ID_OR_EMAIL` Corresponds to the JSON propertyserviceAccount`

Returns:

  • (String)


875
876
877
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 875

def 
  @service_account
end

#source_to_buildGoogle::Apis::CloudbuildV1::GitRepoSource

GitRepoSource describes a repo and ref of a code repository. Corresponds to the JSON property sourceToBuild



880
881
882
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 880

def source_to_build
  @source_to_build
end

#substitutionsHash<String,String>

Substitutions for Build resource. The keys must match the following regular expression: ^_[A-Z0-9_]+$. Corresponds to the JSON property substitutions

Returns:

  • (Hash<String,String>)


886
887
888
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 886

def substitutions
  @substitutions
end

#tagsArray<String>

Tags for annotation of a BuildTrigger Corresponds to the JSON property tags

Returns:

  • (Array<String>)


891
892
893
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 891

def tags
  @tags
end

#trigger_templateGoogle::Apis::CloudbuildV1::RepoSource

Location of the source in a Google Cloud Source Repository. Corresponds to the JSON property triggerTemplate



896
897
898
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 896

def trigger_template
  @trigger_template
end

#webhook_configGoogle::Apis::CloudbuildV1::WebhookConfig

WebhookConfig describes the configuration of a trigger that creates a build whenever a webhook is sent to a trigger's webhook URL. Corresponds to the JSON property webhookConfig



902
903
904
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 902

def webhook_config
  @webhook_config
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
# File 'lib/google/apis/cloudbuild_v1/classes.rb', line 909

def update!(**args)
  @approval_config = args[:approval_config] if args.key?(:approval_config)
  @autodetect = args[:autodetect] if args.key?(:autodetect)
  @build = args[:build] if args.key?(:build)
  @create_time = args[:create_time] if args.key?(:create_time)
  @description = args[:description] if args.key?(:description)
  @disabled = args[:disabled] if args.key?(:disabled)
  @event_type = args[:event_type] if args.key?(:event_type)
  @filename = args[:filename] if args.key?(:filename)
  @filter = args[:filter] if args.key?(:filter)
  @git_file_source = args[:git_file_source] if args.key?(:git_file_source)
  @github = args[:github] if args.key?(:github)
  @id = args[:id] if args.key?(:id)
  @ignored_files = args[:ignored_files] if args.key?(:ignored_files)
  @included_files = args[:included_files] if args.key?(:included_files)
  @name = args[:name] if args.key?(:name)
  @pubsub_config = args[:pubsub_config] if args.key?(:pubsub_config)
  @resource_name = args[:resource_name] if args.key?(:resource_name)
  @service_account = args[:service_account] if args.key?(:service_account)
  @source_to_build = args[:source_to_build] if args.key?(:source_to_build)
  @substitutions = args[:substitutions] if args.key?(:substitutions)
  @tags = args[:tags] if args.key?(:tags)
  @trigger_template = args[:trigger_template] if args.key?(:trigger_template)
  @webhook_config = args[:webhook_config] if args.key?(:webhook_config)
end