SBT-stups is an sbt plugin that contains a set of related tasks for deploying
sbt applications into stups environments. This includes logging creating
scm-source.json
file, logging into pierone
and creating a new application version into kio
Simply put the following into your build/plugins.sbt
file
addSbtPlugin("org.zalando" % "sbt-stups" % "0.3.0")
For this plugin to work, you need to have the following installed on your system and available in your path
- git
- pierone
- kio
- zaws
Since SBT-stups is an autoplugin, you don't need to do anything explicit to enable it.
Before being able to use the plugin, you have to configure the following settings on your building:
- kioTeamName: your team name as known by kio
- pierOneUrl: pier one url where docker images should be published
There are other settings available, as we will see below.
This sbt-plugin is deliberately designed to have a small minimal set of tasks which you integrate with your current sbt build. The plugin has the following tasks
- createScmSource: This creates a
scm-source.json
file. Configure the thescmSourceDirectory
to the location of where you want the file to be created. By default it is created in your base directory however if you are using something like sbt-docker you should probably use something like
scmSourceDirectory := (stagingDirectory in Universal).value
- pierOneLogin: This logs into pierone. This should be done before pushing your repository into docker, i.e. if you are using the sbt-docker plugin.
(dockerPush in docker) := (dockerPush in docker) dependsOn pierOneLogin
- maiLogin: This runs the
mai
command line tool to set up AWS login credentials. You usually dont need to use this task directly ascreateKioVersion
will call this automatically. Use themaiProfile
setting to configure themai
profile you are using - createKioVersion: This will create a new version in kio of your application. The
kioTeamName
,kioApplicationName
,kioApplicationVersion
,dockerArtifactName
anddockerVersion
settings are used to configure the task
If your version of sbt is at least 0.13.8, you can use the following to deploy your application in a single command (again assuming you are using sbt-docker)
lazy val deploy = taskKey[Unit]("Deploys the application into Kio")
// Make our dockerPush login to pierone first
(dockerPush in docker) := (dockerPush in docker) dependsOn pierOneLogin
// Create a docker image, then push into pierone and then create a new version in kio
deploy := Def.sequential(
docker,
dockerPush in docker,
createKioVersion
).value
Then you can simply run deploy
in sbt
, all you need to do afterwards is to update your
application with senza
Please make sure that you format the code using scalafmt
. You can do this by running scalafmt
in sbt before committing.
See scalafmt for more info.
Copyright © 2016 Zalando SE
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.