frodenas / gcs-resource

Concourse resource for interacting with Google Cloud Storage
Apache License 2.0
35 stars 34 forks source link
concourse google-cloud-storage

GCS Resource Build Status

Versions objects in a Google Cloud Storage (GCS) bucket, by pattern-matching filenames to identify version numbers.

This resource is based on the official S3 resource.

Source Configuration

File Names

One of the following two options must be specified:

Initial state

If no resource versions exist you can set up this resource to emit an initial version with a specified content. This won't create a real resource in GCS but only create an initial version for Concourse. The resource file will be created as usual when you get a resource with an initial version.

You can define one of the following two options:

By default the resource file will be created with no content when get runs. You can set the content by using one of the following options:

Behavior

check: Extract versions from the bucket.

Objects will be found via the pattern configured by regexp or versioned_file. The versions will be used to order them (using semver). Each object's filename is the resulting version.

in: Fetch an object from the bucket.

Places the following files in the destination:

Parameters

out: Upload an object to the bucket.

Given a file specified by file, upload it to the GCS bucket. If regexp is specified, the new file will be uploaded to the directory that the regex searches in. If versioned_file is specified, the new file will be uploaded as a new version of that file.

Parameters

Example Configuration

Resource Type

resource_types:
  - name: gcs-resource
    type: docker-image
    source:
      repository: frodenas/gcs-resource

Resource

resources:
  - name: release
    type: gcs-resource
    source:
      bucket: releases
      json_key: <GCS-ACCOUNT-JSON-KEY-CONTENTS>
      regexp: directory_on_gcs/release-(.*).tgz

Plan

- get: release
- put: release
  params:
    file: path/to/release-*.tgz
    predefined_acl: publicRead
    content_type: application/octet-stream
    cache_control: max-age=3600

Development

Contributing

Refer to the contributing guidelines.

License

Apache License 2.0, see LICENSE.