Add service for mssql server databases

On my local computer when I want to set up a test database for testing I just run this command:

docker run --name test_mssql_server -e ‘ACCEPT_EULA=Y’ -e SA_PASSWORD=$MSSQL_PWD -p 1433:1433 -d microsoft/mssql-server-linux

At the moment if I want this on Travis CI I need to use a complex docker-build script. As a result I don’t use Travic CI for my projects that use a mssql database. It would be great to have a service for mssql_server that behaves in a similar way to the other database services.

tl;dr add mssql_server to this list of database services:

Regards,
whossname

This isn’t what I am trying to do. It’s a linux deployment that uses a mssql database. This isn’t hard to setup on a linux machine. The docker command above for creating a test database works fine on a linux machine, but doesn’t seem to do the job in a Travis script.

Please link to a build then to showcase what you are trying to do.

If MSSQL is available for Ubuntu, you should be able to install it with apt from the provider’s repository then start the resulting service and whatnot.

To be clear, I am not asking for help. This is a feature request.

This is an example of how it is currently done:

There are plenty of scripts like that in the wild at the moment.

It seems needlessly complex to me. I want to be able to do it like this instead:

sudo: required

language: elixir
elixir: 1.6.5

services:
 - mssql_server

before_script:
- ./build_test_database.sh
- mix deps.get

script: 
  - mix format --check-formatted
  - mix compile --warnings-as-errors
  - mix coveralls.travis

Most of the complexity I want to avoid is in the docker-compose file. It seems like a pretty easy feature to add, when you consider that most other databases are already supported, and there is an existing docker file to use as a base.

Okay, I see. This should be possible as an addon similar to https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/addons/mariadb.rb.

The official installation procedure is described at https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu.

Ok, cool. I’ll have a look at this when I next have some free time.

Thanks.

Ok, so I have a basic implementation over here: https://github.com/travis-ci/travis-build/compare/master...whossname:dev

I still need to test it properly on a virtual machine, but I think this will be basically it. I won’t get around to testing it properly until next week.

Is this ready for a pull request or should I wait until I have done the testing? The biggest issue I see at the moment is that the username/password are hardcoded. I’m hoping to find a fix for that while I am doing the testing.

Create a pull request when you are ready to show your code for code review.

To my knowledge, other DB addons leave the server in the default configuration that the corresponding Apt package creates. Relieves Travis from having to maintain additional setup code and leaves it up to package maintainers who know better to provide a sensible default “blank state”.

Ah. The issue with mssql is that the setup requires you to set a password, there is no default. The default user is ‘sa’ so I guess that is fine.

I have included the password as an environment variable, so users should be able to run sqlcmd -Q {user's sql code here} in the .travis.yml files. I think that should be enough to set everything up.

This is something I will test next week.

Check what other DB addons do and do likewise. IIRC MariaDB’s installation also asks for a password – but the addon somehow resolves this.

Imprint