github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/github/yaml/pipeline.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
    16  
    17  type (
    18  	Pipeline struct {
    19  		Concurrency *Concurrency      `yaml:"concurrency,omitempty"`
    20  		Defaults    *Defaults         `yaml:"defaults,omitempty"`
    21  		Env         map[string]string `yaml:"env,omitempty"`
    22  		Jobs        map[string]*Job   `yaml:"jobs,omitempty"`
    23  		Name        string            `yaml:"name,omitempty"`
    24  		On          *On               `yaml:"on,omitempty"`
    25  		Permissions *Permissions      `yaml:"permissions,omitempty"`
    26  		RunName     string            `yaml:"run-name,omitempty"`
    27  	}
    28  
    29  	Credentials struct {
    30  		Username string `yaml:"username,omitempty"`
    31  		Password string `yaml:"password,omitempty"`
    32  	}
    33  
    34  	Defaults struct {
    35  		Run *Run `yaml:"run,omitempty"`
    36  	}
    37  
    38  	Event struct {
    39  		Types []string `yaml:"types,omitempty"`
    40  	}
    41  
    42  	Input struct {
    43  		Default     interface{} `yaml:"default,omitempty"`
    44  		Description string      `yaml:"description,omitempty"`
    45  		Options     interface{} `yaml:"options,omitempty"`
    46  		Required    bool        `yaml:"required,omitempty"`
    47  		Type        string      `yaml:"type,omitempty"`
    48  	}
    49  
    50  	Job struct {
    51  		Concurrency   *Concurrency        `yaml:"concurrency,omitempty"`
    52  		Container     *Container          `yaml:"container,omitempty"`
    53  		ContinueOnErr bool                `yaml:"continue-on-error,omitempty"` // TODO string instead of bool? `continue-on-error: ${{ matrix.experimental }}`
    54  		Defaults      *Defaults           `yaml:"defaults,omitempty"`
    55  		Env           map[string]string   `yaml:"env,omitempty"`
    56  		Environment   *Environment        `yaml:"environment,omitempty"`
    57  		If            string              `yaml:"if,omitempty"`
    58  		Name          string              `yaml:"name,omitempty"`
    59  		Needs         Stringorslice       `yaml:"needs,omitempty"`
    60  		Outputs       map[string]string   `yaml:"outputs,omitempty"`
    61  		Permissions   *Permissions        `yaml:"permissions,omitempty"`
    62  		RunsOn        string              `yaml:"runs-on,omitempty"`
    63  		Secrets       *Secrets            `yaml:"secrets,omitempty"`
    64  		Services      map[string]*Service `yaml:"services,omitempty"`
    65  		Steps         []*Step             `yaml:"steps,omitempty"`
    66  		Strategy      *Strategy           `yaml:"strategy,omitempty"`
    67  		TimeoutMin    int                 `yaml:"timeout-minutes,omitempty"`
    68  		Uses          string              `yaml:"uses,omitempty"`
    69  		With          map[string]string   `yaml:"with,omitempty"`
    70  	}
    71  
    72  	Matrix struct {
    73  		Exclude []map[string]interface{} `yaml:"exclude,omitempty"`
    74  		Include []map[string]interface{} `yaml:"include,omitempty"`
    75  		Matrix  map[string][]string      `yaml:",inline"`
    76  	}
    77  
    78  	PullRequest struct {
    79  		Branches        []string `yaml:"branches,omitempty"`
    80  		BranchesIgnore  []string `yaml:"branches-ignore,omitempty"`
    81  		Paths           []string `yaml:"paths,omitempty"`
    82  		PathsIgnore     []string `yaml:"paths-ignore,omitempty"`
    83  		Tags            []string `yaml:"tags,omitempty"`
    84  		TagsIgnore      []string `yaml:"tags-ignore,omitempty"`
    85  		Types           []string `yaml:"types,omitempty"`
    86  		ReviewApproved  bool     `yaml:"review-approved,omitempty"`
    87  		ReviewDismissed bool     `yaml:"review-dismissed,omitempty"`
    88  	}
    89  
    90  	PullRequestTarget struct {
    91  		Branches       []string `yaml:"branches,omitempty"`
    92  		BranchesIgnore []string `yaml:"branches-ignore,omitempty"`
    93  		Types          []string `yaml:"types,omitempty"`
    94  	}
    95  
    96  	Push struct {
    97  		Branches       []string `yaml:"branches,omitempty"`
    98  		BranchesIgnore []string `yaml:"branches-ignore,omitempty"`
    99  		Paths          []string `yaml:"paths,omitempty"`
   100  		PathsIgnore    []string `yaml:"paths-ignore,omitempty"`
   101  		Tags           []string `yaml:"tags,omitempty"`
   102  		TagsIgnore     []string `yaml:"tags-ignore,omitempty"`
   103  	}
   104  
   105  	Run struct {
   106  		Shell      string `yaml:"shell,omitempty"`
   107  		WorkingDir string `yaml:"working-directory,omitempty"`
   108  	}
   109  
   110  	Service struct {
   111  		Env         map[string]string `yaml:"env,omitempty"`
   112  		Image       string            `yaml:"image,omitempty"`
   113  		Networks    []string          `yaml:"networks,omitempty"`
   114  		Options     []string          `yaml:"options,omitempty"`
   115  		Ports       []string          `yaml:"ports,omitempty"`
   116  		Volumes     []string          `yaml:"volumes,omitempty"`
   117  		Credentials *Credentials      `yaml:"credentials,omitempty"`
   118  	}
   119  
   120  	Step struct {
   121  		ContinueOnErr bool                   `yaml:"continue-on-error,omitempty"`
   122  		Env           map[string]string      `yaml:"env,omitempty"`
   123  		If            string                 `yaml:"if,omitempty"`
   124  		Name          string                 `yaml:"name,omitempty"`
   125  		Run           string                 `yaml:"run,omitempty"`
   126  		Timeout       int                    `yaml:"timeout-minutes,omitempty"`
   127  		With          map[string]interface{} `yaml:"with,omitempty"`
   128  		Uses          string                 `yaml:"uses,omitempty"`
   129  	}
   130  
   131  	Strategy struct {
   132  		Matrix      *Matrix `yaml:"matrix,omitempty"`
   133  		FailFast    bool    `yaml:"fail-fast,omitempty"`
   134  		MaxParallel int     `yaml:"max-parallel,omitempty"`
   135  	}
   136  
   137  	WorkflowCall struct {
   138  		Inputs    map[string]interface{}         `yaml:"inputs,omitempty"`
   139  		Outputs   map[string]interface{}         `yaml:"outputs,omitempty"`
   140  		Secrets   map[string]*WorkflowCallSecret `yaml:"secrets,omitempty"`
   141  		Workflows []string                       `yaml:"workflows,omitempty"`
   142  	}
   143  
   144  	WorkflowCallSecret struct {
   145  		Description string `yaml:"description,omitempty"`
   146  		Required    bool   `yaml:"required,omitempty"`
   147  	}
   148  
   149  	WorkflowDispatch struct {
   150  		Inputs map[string]*Input `yaml:"inputs,omitempty"`
   151  	}
   152  
   153  	WorkflowRun struct {
   154  		Branches       []string `yaml:"branches,omitempty"`
   155  		BranchesIgnore []string `yaml:"branches-ignore,omitempty"`
   156  		Types          []string `yaml:"types,omitempty"`
   157  		Workflows      []string `yaml:"workflows,omitempty"`
   158  	}
   159  )