Skip to content
/ sbt-gcs Public

An sbt plugin for publishing artifacts to Google Cloud Storage.

License

Notifications You must be signed in to change notification settings

Tapad/sbt-gcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-gcs

Bintray

An sbt plugin for publishing artifacts to Google Cloud Storage. It is highly inspired by Tapad/sbt-hadoop plugin.

Requirements

  • sbt (0.13.5+ or 1.0.0+)

Installation

Add the following line to project/plugins.sbt. See the Using plugins section of the sbt documentation for more information.

addSbtPlugin("com.tapad.sbt" % "sbt-gcs" % SbtGcsVersion)

where SbtGcsVersion should be taken from badge at the top.

Credentials

Authentication to Google Cloud Storage has to be provided. The following are searched (in order) to find the Application Default Credentials:

  • Credentials file pointed to by the GOOGLE_APPLICATION_CREDENTIALS environment variable
  • Credentials provided by the Google Cloud SDK gcloud auth application-default login command
  • Google App Engine built-in credentials
  • Google Cloud Shell built-in credentials
  • Google Compute Engine built-in credentials

Usage

Assuming that credentials are provided, one can just enable the plugin:

enablePlugins(GcsPlugin)

and set required settings:

gcsProjectId := "my-google-cloud-project"
gcsBucket := "gcs-bucket.tapad.com"

The location on GCS can be specfied using gcsArtifactPath setting. The default value is:

gs://{gcsBucket}/{releases|snapshots}/{organization}/{name}/{version}/{name}-{version}.jar

(e.g. gs://gcs-bucket.tapad.com/snapshots/com/tapad/sbt/sbt-gcs/0.1.1-SNAPSHOT/sbt-gcs-0.1.1-SNAPSHOT.jar)

Integration with the built-in packageBin task

By default, sbt-gcs is configured to upload the resulting artifact of the packageBin task to GCS.

Once your build is properly configured, an invocation of gcs:publish will build, and subsequentially publish, your artifact to GCS.

For more information, refer to the Packaging documentation provided in the sbt reference manual.

Integration with sbt-assembly

To use sbt-gcs in conjunction with sbt-assembly, add the following to your project/plugins.sbt and build.sbt files, respectively:

addSbtPlugin("com.eed3sign" % "sbt-assembly" % "X.Y.Z")
addSbtPlugin("com.tapad.sbt" % "sbt-gcs" % SbtGcsVersion)
gcsLocalArtifactPath := (assemblyOutputPath in assembly).value
gcsProjectId := "my-google-cloud-project"
gcsBucket := "gcs-bucket.tapad.com"
publish := publish.dependsOn(assembly).value

Lastly, be sure to enable sbt-gcs in your build.sbt file:

enablePlugins(GcsPlugin)

sbt-assembly will be enabled automatically.

Once the build definition is configured properly, an invocation of gcs:publish will build and subsequentially publish a fat jar to GCS.

For more information, refer to the documentation provided by sbt-assembly and the scripted integration test found at plugin/src/sbt-test/sbt-hadoop/assembly.

IntegrationTest scope

Artifacts can be published to another project and bucket for integration tests using scopes.

inConfig(IntegrationTest)(GcsPlugin.baseSettings ++ Seq(
    gcsProjectId := "my-google-cloud-it-project",
    gcsBucket := "gcs-it-bucket.tapad.com"
)

Contributing

root

The sbt plugin and underlying interface used to publish artifacts to GCS.

Running tests

The main features and functionality of sbt-gcs are tested using sbt's scripted-plugin. scripted tests exist in the src/sbt-test directory of the root project.

To run these tests, issue scripted from an sbt session:

$ sbt
> scripted

To selectively run a single scripted test suite, issue scripted <name of plugin>/<name of test project>. e.g. scripted sbt-gcs/simple.

Please note that publishLocal will be invoked when running scripted. scripted tests take longer to run than unit tests and will log myriad output to stdout. Also note that any output written to stderr during the execution of a scripted test will result in ERROR level log entries. These log entries will not effect the resulting status of the actual test.

Releasing artifacts

sbt-gcs uses https://github.com/sbt/sbt-release. Simply invoke release from the root project to release all artifacts.

About

An sbt plugin for publishing artifacts to Google Cloud Storage.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages