I am migrating pipelines from v1.0 to 2.0, using docker.
I have tried half a dozen different dockers providing Scala with SBT, and others seem statisfied with that, but whatever image I choose, I always get this output:
#!/bin/bash -eo pipefail
sbt sbtVersion
/bin/bash: sbt: command not found
I am trying to simply run “sbt sbtVersion”, which should print the version of SBT I have in my environment.
Nevermind, I searched for hours but I think I understood how it works 2 mins after posting this.
One cannot use multiple dockers to add content to the environment, only to deploy services. So I should create a custom docker image or install SBT manually inside the current environment.
@mecampbellsoup It is not public, but I copied below the circle.yml I ended up using for my tests.
My problem was that I thought one could load several services in the environment by specifying several docker images. It does not work like that: the docker container is a replacement for a (single) virtual machine. Either use an existing one, or create a custom Docker image with everything you need inside of it (maybe with a docker-compose, but I am not sure it creates a new image).
machine:
#timezone: Europe/Zurich
java:
version: openjdk8
services:
- mysql
# Collect build artifacts
general:
artifacts:
- target/universal
dependencies:
pre:
# - sbt about
# Cache the resolution-cache and build streams to speed things up
cache_directories:
- "~/.sbt"
- "target/resolution-cache"
- "target/streams"
- "project/target/resolution-cache"
- "project/target/streams"
# Compile all sources
override:
#- sbt update
- sbt test:compile
database:
override:
- mysql -V
- mysql -u ubuntu --execute "CREATE USER 'testuser'@'localhost';"
- mysql -u ubuntu --execute "DROP DATABASE if exists uhtslimstest;"
- mysql -u ubuntu --execute "CREATE DATABASE uhtslimstest;"
- mysql -u ubuntu --execute "GRANT ALL PRIVILEGES ON uhtslimstest.* TO 'testuser'@'localhost';"
test:
override:
- sbt test:test
# Copy test reports to Circle test reports dir then package app for deploy
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/target/test-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;