github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/cloudbuild/yaml/config.go (about) 1 // Copyright 2022 Harness, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // package yaml provides definitions for the Cloud Build schema. 16 package yaml 17 18 import "time" 19 20 type ( 21 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#resource:-build 22 Config struct { 23 Steps []*Step `yaml:"steps,omitempty"` 24 Timeout time.Duration `yaml:"timeout,omitempty"` 25 Queuettl time.Duration `yaml:"queueTtl,omitempty"` 26 Logsbucket string `yaml:"logsBucket,omitempty"` 27 Options *Options `yaml:"options,omitempty"` 28 Substitutions map[string]string `yaml:"substitutions,omitempty"` 29 Tags []string `yaml:"tags,omitempty"` 30 Serviceaccount string `yaml:"serviceAccount,omitempty"` 31 Secrets []*Secret `yaml:"secrets,omitempty"` 32 Availablesecrets *AvailableSecrets `yaml:"availableSecrets,omitempty"` 33 Artifacts *Artifacts `yaml:"artifacts,omitempty"` 34 Images []string `yaml:"images,omitempty"` 35 } 36 37 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#artifacts 38 Artifacts struct { 39 Objects *ArtifactObjects `yaml:"objects,omitempty"` 40 Mavenartifacts []*MavenArifact `yaml:"mavenArtifacts,omitempty"` 41 Pythonpackages []*PythonPackage `yaml:"pythonPackages,omitempty"` 42 } 43 44 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#artifactobjects 45 ArtifactObjects struct { 46 Location string `yaml:"location,omitempty"` 47 Paths []string `yaml:"paths,omitempty"` 48 } 49 50 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#Build.Secrets 51 AvailableSecrets struct { 52 SecretManager []*SecretManagerSecret `yaml:"secretManager,omitempty"` 53 Inline []*Secret `yaml:"inline,omitempty"` 54 } 55 56 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#mavenartifact 57 MavenArifact struct { 58 Repository string `yaml:"repository,omitempty"` 59 Path string `yaml:"path,omitempty"` 60 Artifactid string `yaml:"artifactId,omitempty"` 61 Groupid string `yaml:"groupId,omitempty"` 62 Version string `yaml:"version,omitempty"` 63 } 64 65 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#buildoptions 66 Options struct { 67 Sourceprovenancehash string `yaml:"sourceProvenanceHash,omitempty"` // ENUM 68 Machinetype string `yaml:"machineType,omitempty"` // ENUM 69 Disksizegb string `yaml:"diskSizeGb,omitempty"` 70 Substitutionoption string `yaml:"substitutionOption,omitempty"` // ENUM 71 Dynamicsubstitutions string `yaml:"dynamicSubstitutions,omitempty"` 72 Logstreamingoption string `yaml:"logStreamingOption,omitempty"` // ENUM 73 Logging string `yaml:"logging,omitempty"` // ENUM 74 Defaultlogsbucketbehavior string `yaml:"defaultLogsBucketBehavior,omitempty"` // ENUM 75 Env []string `yaml:"env,omitempty"` 76 Secretenv []string `yaml:"secretEnv,omitempty"` 77 Volumes []*Volume `yaml:"volumes,omitempty"` 78 Pool *Pool `yaml:"pool,omitempty"` 79 Requestedverifyoption string `yaml:"requestedVerifyOption,omitempty"` // ENUM 80 } 81 82 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#Build.PoolOption 83 Pool struct { 84 Name string `yaml:"name,omitempty"` 85 } 86 87 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#pythonpackage 88 PythonPackage struct { 89 Repository string `yaml:"repository,omitempty"` 90 Paths []string `yaml:"paths,omitempty"` 91 } 92 93 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#secret 94 Secret struct { 95 KMSKeyName string `yaml:"kmsKeyName,omitempty"` 96 SecretEnv map[string]string `yaml:"secretEnv,omitempty"` 97 } 98 99 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#secretmanagersecret 100 SecretManagerSecret struct { 101 VersionName string `yaml:"versionName,omitempty"` 102 Env map[string]string `yaml:"env,omitempty"` 103 } 104 105 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#buildstep 106 Step struct { 107 Name string `yaml:"name,omitempty"` 108 Args []string `yaml:"args,omitempty"` 109 Env []string `yaml:"env,omitempty"` 110 Allowfailure bool `yaml:"allowFailure,omitempty"` 111 Allowexitcodes []string `yaml:"allowExitCodes,omitempty"` 112 Dir string `yaml:"dir,omitempty"` 113 ID string `yaml:"id,omitempty"` 114 Waitfor []string `yaml:"waitFor,omitempty"` 115 Entrypoint string `yaml:"entrypoint,omitempty"` 116 Secretenv string `yaml:"secretEnv,omitempty"` 117 Volumes []*Volume `yaml:"volumes,omitempty"` 118 Timeout time.Duration `yaml:"timeout,omitempty"` 119 Script string `yaml:"script,omitempty"` 120 } 121 122 // https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds#volume 123 Volume struct { 124 Name string `yaml:"name,omitempty"` 125 Path string `yaml:"path,omitempty"` 126 } 127 )