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
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
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.jsonfile. Configure the the
scmSourceDirectoryto 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
maicommand line tool to set up AWS login credentials. You usually dont need to use this task directly as
createKioVersionwill call this automatically. Use the
maiProfilesetting to configure the
maiprofile you are using
- createKioVersion: This will create a new version in kio of your application. The
dockerVersionsettings are used to configure the task
Example of deployment pipeline
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
sbt, all you need to do afterwards is to update your application with
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
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.