Categorygithub.com/vmware-archive/bom-mgmt
module
1.0.5
Repository: https://github.com/vmware-archive/bom-mgmt.git
Documentation: pkg.go.dev

# README

Bill of Materials Management (bom-mgmt)

Go automation for downloading and/or uploading(to a Minio server) a set of files from a Bill of Materials (BoM).

Bill of Materials

This product utilizes a YAML file structure that lays out a bill of materials like this:

pivnet_token: abcdefghijklmnop
myvmware_user: [email protected]
myvmware_password: password1!
iaas: vsphere
bits:
- name: abc.txt
  contentType: text/plain
  resourceType: file
  url: https://foo.com/download/abc.txt
- name: repo.zip
  contentType: application/zip
  resourceType: git
  branch: master
  gitRepo: https://github.com/myuser/repo
- name: ubuntu.tgz
  contentType: application/gzip
  resourceType: docker
  imageName: ubuntu
- name: vmware_tool.ova
  contentType: application/vmware
  resourceType: vmware
  productFamily: vmware-vsphere
  productSlug: vmware_tool-1.1.1.ova
  group: "Set of Tools"
- name: pivotal-container-service-1.1.2.tgz
  contentType: application/gzip
  productSlug: pivotal-container-service
  version: 1.1.2
  globs: ["*.pivotal"]
  resourceType: pivnet-tile
- name: pcf-ops-manager-2.2.1.ova
  contentType: application/vmware
  productSlug: ops-manager
  version: 2.2.1
  globs: ["*vsphere*"]
  resourceType: pivnet-non-tile

Build from the source

bom-mgmt is written in Go. To build the binary yourself, follow these steps:

  • Install Go.
  • Install Dep, a dependency management tool for Go.
  • Clone the repo:
    • mkdir -p $(go env GOPATH)/src/github.com/pivotalservices
    • cd $(go env GOPATH)/src/github.com/pivotalservices
    • git clone [email protected]:pivotalservices/bom-mgmt.git
  • Install dependencies:
    • cd bom-mgmt
    • dep ensure
    • go build -o bom-mgmt cmd/bom-mgmt/main.go

To cross compile, set the $GOOS and $GOARCH environment variables. For example: GOOS=linux GOARCH=amd64 go build.

Uploading

export MINIO_HOST="localhost:9000"
export MINIO_ACCESS_KEY="key"
export MINIO_SECRET="secretsquirrel"

bom-mgmt upload-bits --bits "/Users/foo/test-bits" --bom "bom.yml" --bucket "bar"

Parameters

All of the necessary parameters can either be passed on the command line or as environment variables.

CLI ParamEnv Var
hostMINIO_HOST
keyMINIO_ACCESS_KEY
secretMINIO_SECRET
bucketMINIO_BUCKET
bitsMINIO_BITS_DIR
bomMINIO_BOM

Downloading

bom-mgmt download-bits --bits "/Users/foo/test-bits" --bom "bom.yml"

Parameters

All of the necessary parameters can either be passed on the command line or as environment variables.

CLI ParamEnv Var
bitsMINIO_BITS_DIR
bomMINIO_BOM

Resource Types

TypeAdditional BoM ParamsRequirementsOutput
fileurlthe specified file
gitbranch, gitRepo.tgz of the repo
dockerimageName, tag (optional)Uses docker environment from machine.tgz of the image
vmwareproductSlug,productFamilyNeed to provide myvmware credentials in BoMthe specified file
pivnet-tileproductSlug, globs, versionNeed to provide pivnetToken in Bom.tgz of tile and needed stemcell
pivnet-non-tileproductSlug, globs, versionNeed to provide pivnetToken in Bomthe specified file

File Paths

TypePath
file{MINIO_BITS_DIR}/resources/file/{filename}
git{MINIO_BITS_DIR}/resources/git/{filename}
docker{MINIO_BITS_DIR}/resources/docker/{filename}
vmware{MINIO_BITS_DIR}/resources/vmware/{filename}
pivnet-tile{MINIO_BITS_DIR}/resources/pivnet-tile/{productSlug}-tarball/{filename}
pivnet-non-tile{MINIO_BITS_DIR}/resources/pivnet-non-tile/{filename}

Generating Resources Block

This command will use the contents of the BoM and Minio server information to generate a resources block that can be used in a Concourse pipeline. Each resource will be of type s3 and point to the Minio server and bucket provided using the paths above.

export MINIO_HOST="localhost:9000"
export MINIO_ACCESS_KEY="key"
export MINIO_SECRET="secretsquirrel"

bom-mgmt generate-resources --bom "bom.yml" --bucket "bar"

Assumptions

  • The Docker CLI is present on the system running this script

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author