in Education by
I have a self hosted gitlab on ubuntu machine. I configure a linux container for it to run runner. Now, I am trying to write a configuration for my dotnet project to run unit test on this setup. I get configuration to run dotnet application without database, and only part I got stuck is that I cannot get Database to load or connect through my test environment. I get SQL Server linux container to run as service (I am guessing it is running). But I am not sure how I can load my database to it. I know I can do that using Docker Run. But I cannot figure it out how to run it here. When I try to run "mssql-tools" as service I cannot get it's command to run as it is not install by default in dotnet image. Here is my file. image: microsoft/dotnet:latest variables: ACCEPT_EULA: Y SA_PASSWORD: my_secure_password MSSQL_PID: Developer stages: - test before_script: - "cd Source" - "dotnet restore" test: stage: test services: - mcr.microsoft.com/mssql/server:2017-latest - mcr.microsoft.com/mssql-tools script: - "cd ../Database" - "docker run -it mcr.microsoft.com/mssql-tools" - "sqlcmd -S . -U SA -P my_secure_password -i testdata_structure.sql" - "exit" - "cd ../Source" - "dotnet build" - "dotnet test" "sqlcmd -S . -U SA -P my_secure_password -i testdata_structure.sql this command won't work in this setup as sqlcmd is not installed, but is one of service. I don't want to make a new image that has all pre-install. But use available stuff to work. Not, sure if I am able to explain my issue and knowledge here. I am new, but I am reading and changing configuration from 2 days. I can get Linux based SQL Server to run with my app from local docker commands and stuff, but on Gitlab to run Unit Test I cannot get database to restore/get running and connect to application. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
GitLab Services does not install commands or apps inside your container job, instead a Service is another container that is usually run in parallel to offer infrastructure services such as databases, cache, queues, etc. if you want to have sqlcmd inside your container you must install it: This is an extract from my pipeline, in this case my container is based on Alpine but you can find more ways here: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15 before_script: - apk add curl - apk add --no-cache gnupg - curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.7.2.1-1_amd64.sig - curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.7.1.1-1_amd64.sig - curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.7.2.1-1_amd64.apk - curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.7.1.1-1_amd64.apk - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import - - gpg --verify msodbcsql17_17.7.2.1-1_amd64.sig msodbcsql17_17.7.2.1-1_amd64.apk - gpg --verify mssql-tools_17.7.1.1-1_amd64.sig mssql-tools_17.7.1.1-1_amd64.apk - apk add --allow-untrusted msodbcsql17_17.7.2.1-1_amd64.apk - apk add --allow-untrusted mssql-tools_17.7.1.1-1_amd64.apk script: - /opt/mssql-tools/bin/sqlcmd -S $DBC_SERVER -U $DBC_USER -P $DBC_PASSWORD -q "USE myTestDb; CREATE TABLE testGitlab (id int); SELECT * FROM testGitLab"

Related questions

0 votes
    Having a Golang project and Go workspace. I'm trying to run my test, but I'm having the following ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I try to create database from entity framework code first follow with this tutorial http://www.asp.net/mvc ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    Let's say you have a typical web app and with a file configuration.whatever. Every developer working on ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I'm currently developing a web application using asp.net c#. I got a server where I today was ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I am writing a powershell script that will automate a dev environment deployment and I've hit a problem ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 11, 2022 in Education by JackTerrance
0 votes
    i have online Wordpress blog, now i copied my blog to localhost to change the design. I replaced http ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    In _________ model, the configuration server automatically sends the updated configuration file if there is any change. 1. Both the options 2. Push 3. Pull...
asked Sep 18, 2021 in Technology by JackTerrance
0 votes
    In _________ model, the configuration server is checked periodically for updates. 1. Pull 2. Push 3. Both the options...
asked Sep 18, 2021 in Technology by JackTerrance
0 votes
    When a server requires special configuration beyond that covered by the automated deployment scripts, it is ... Snowflake Server Configuration Drift Server Sprawl Automation Fear...
asked Sep 15, 2021 in Technology by JackTerrance
0 votes
    In which file database table configuration is stored? (a) .dbm (b) .hbm (c) .ora (d) .sql This ... Autoboxing & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    In which file database table configuration is stored? (a) .dbm (b) .hbm (c) .ora (d) .sql ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Is it possible to remove ( not hide using display:none ) some part of HTML from source for mobile ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 15, 2022 in Education by JackTerrance
...