Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Metadata CLI

Build Status Latest Release Go Report Card

CLI for reading/writing project metadata

Usage

$ go get github.com/screwdriver-cd/meta-cli
$ cd $GOPATH/src/github.com/screwdriver-cd/meta-cli
$ go build -a -o meta
$ ./meta --help
NAME:
   meta-cli - get or set metadata for Screwdriver build

USAGE:
   meta command arguments [options]

VERSION:
   0.0.0

COMMANDS:
     get      Get a metadata with key
     set      Set a metadata with key and value
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --meta-space value          Location of meta temporarily (default: "/sd/meta")
   --loglevel value, -l value  Set the loglevel (default: "info")
   --help, -h                  show help
   --version, -v               print the version

COPYRIGHT:
   (c) 2017 Yahoo Inc.

---
NAME:
   meta get - Get a metadata with key

USAGE:
   meta get [command options] [arguments...]

OPTIONS:
   --external value, -e value        MetaFile pipeline meta (default: "meta")
   --skip-fetch, -F                  Used with --external to skip fetching from lastSuccessfulMeta when not triggered by external job
   --json-value, -j                  Treat value as json. When false, set values are treated as string; get is value-dependent and strings are not json-escaped
   --sd-token value, -t value        Set the SD_TOKEN to use in SD API calls [$SD_TOKEN]
   --sd-api-url value, -u value      Set the SD_API_URL to use in SD API calls (default: "https://api.screwdriver.cd/v4/") [$SD_API_URL]
   --sd-pipeline-id value, -p value  Set the SD_PIPELINE_ID of the job for fetching last successful meta (default: 0) [$SD_PIPELINE_ID]
   --skip-store                      Used with --external to skip storing external metadata in the local meta
   --cache-local                     Used with external, this flag saves a copy of the key/value pair in the local meta

---
NAME:
   meta set - Set a metadata with key and value

USAGE:
   meta set [command options] [arguments...]

OPTIONS:
   --json-value, -j  Treat value as json. When false, set values are treated as string; get is value-dependent and strings are not json-escaped

$ ./meta set aaa bbb
$ ./meta get aaa
bbb
$ ./meta set foo[2].bar[1] baz
[null,null,{"bar":[null,"baz"]}]
$ ./meta set foo '{"bar": "baz", "buz": 123}' --json-value
$ ./meta get foo --json-value
{"bar":"baz","buz":123}
$ ./meta get foo.bar
baz
$ ./meta get foo.bar --json-value
"baz"
$ ./meta get meta --external sd@123:other-job
$ # For scheduled jobs, e.g. that trigger things normally triggered by component:
  if [[ "$(./meta get -j meta)" == null ]]; then
      ./meta set -j meta "$(meta get meta -j --external component)"
  fi

Testing

$ go get github.com/screwdriver-cd/meta-cli
$ go test -cover github.com/screwdriver-cd/meta-cli/...

License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.

You can’t perform that action at this time.