如何在gitlab-CI上配置或禁用kerberos?

时间:2019-12-11 16:52:36

标签: sql-server gitlab-ci pipeline

我正在尝试在项目中配置gitlab.ci,基本上我想在推送时运行所有django测试,显然一切都正确,但我总是会遇到msm错误。由于某些原因,我需要使用sqlServer。错误是:

django.db.utils.Error: ('HY000', '[HY000] [unixODBC][Microsoft][ODBC Driver 
17 for SQL Server]SSPI Provider: No Kerberos credentials available (default 
cache: FILE:/tmp/krb5cc_0) (851968) (SQLDriverConnect)')

这是我的.gitlab.ci.yml

#Gitlab - CI Pipeline
#Docker image
image: python:3.7

stages:
  - Django Test

database:
  image: zerogjoe/mssql-python3.6-pyodbc
  services:
    - name: microsoft/mssql-server-linux
      alias: mssql

  variables:
    ACCEPT_EULA: Y
    DB_HOST: mssql
    DATABASE_NAME: GitLab
    DATABASE_DSN: local
    DATABASE_PORT: 1433
    USER: ############
    PASSWORD: ########
    SA_PASSWORD: ########
    DRIVERODBC: ODBC Driver 17 for SQL Server
    DATABASE_DSN: local
    SECRET_KEY: ###################

  stage: Django Test
  script:
    - apt-get update
    - echo  [$DATABASE_DSN] > /etc/odbc.ini
    - echo Description = MYSERVER >> /etc/odbc.ini
    - echo Driver = ODBC Driver 17 for SQL Server >> /etc/odbc.ini
    - echo Server = 172.17.0.3, $DATABASE_PORT >> /etc/odbc.ini
    - echo Database = GitLab >> /etc/odbc.ini
    - /opt/mssql-tools/bin/sqlcmd -S $DB_HOST -U $USER -P $PASSWORD -Q "CREATE DATABASE GitLab"
    - pip install -r api/requirements.txt &>/dev/null
    - cd api && /usr/bin/python3 manage.py test

0 个答案:

没有答案