Documentation ¶
Overview ¶
Package gcsupload uploads artifacts to a GCS path resolved from job configuration
Index ¶
Constants ¶
const ( // JSONConfigEnvVar is the environment variable that // utilities expect to find a full JSON configuration // in when run. JSONConfigEnvVar = "GCSUPLOAD_OPTIONS" )
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
Encode will encode the set of options in the format that is expected for the configuration environment variable.
func PathsForJob ¶
func PathsForJob(options *kube.GCSConfiguration, spec *downwardapi.JobSpec, subdir string) (string, string, gcs.RepoPathBuilder)
PathsForJob determines the following for a job:
- path in GCS under the bucket where job artifacts will be uploaded for:
- the job
- this specific run of the job (if any subdir is present)
The builder for the job is also returned for use in other path resolution.
Types ¶
type Options ¶
type Options struct { // Items are files or directories to upload. Items []string `json:"items,omitempty"` // SubDir is appended to the GCS path. SubDir string `json:"sub_dir,omitempty"` *kube.GCSConfiguration // GcsCredentialsFile is the path to the JSON // credentials for pushing to GCS. GcsCredentialsFile string `json:"gcs_credentials_file,omitempty"` DryRun bool `json:"dry_run"` // contains filtered or unexported fields }
Options exposes the configuration necessary for defining where in GCS an upload will land.
func NewOptions ¶
func NewOptions() *Options
NewOptions returns an empty Options with no nil fields.
func (*Options) AddFlags ¶
AddFlags adds flags to the FlagSet that populate the GCS upload options struct given.
func (*Options) ConfigVar ¶
ConfigVar exposes the environment variable used to store serialized configuration.
func (*Options) LoadConfig ¶
LoadConfig loads options from serialized config
func (Options) Run ¶
func (o Options) Run(spec *downwardapi.JobSpec, extra map[string]gcs.UploadFunc) error
Run will upload files to GCS as prescribed by the options. Any extra files can be passed as a parameter and will have the prefix prepended to their destination in GCS, so the caller can operate relative to the base of the GCS dir.