mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.95k stars 562 forks source link

CI failing SQL Server: no sqlcmd #1380

Closed mkleehammer closed 2 months ago

mkleehammer commented 2 months ago

The CI jobs are failing with this message:

OCI runtime exec failed: exec failed: unable to start container process: exec: "/opt/mssql-tools/bin/sqlcmd": stat /opt/mssql-tools/bin/sqlcmd: no such file or directory: unknown

Possibly related to this?

https://github.com/microsoft/mssql-docker/issues/892

mkleehammer commented 2 months ago

https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-ver16&tabs=redhat-install#install-tools-on-linux

According to the bug report in the description and this documentation it points to, it should be as easy as adding "18" to the directory name (and maybe add -C). It says the docker image should already contain it. I tried on a fix-ss-tests branch and it isn't working.

OCI runtime exec failed: exec failed: unable to start container process: exec: "/opt/mssql-tools18/bin/sqlcmd": stat /opt/mssql-tools18/bin/sqlcmd: no such file or directory: unknown

mkleehammer commented 2 months ago

https://github.com/microsoft/mssql-docker/issues/894

keitherskine commented 2 months ago

Adding "18" and "-C" to the mssql2019 and mssql2022 commands (but leaving mssql2017 as was) seems to work:

        echo "*** SQL Server 2017"
        docker exec -i "${{ job.services.mssql2017.id }}" /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'StrongPassword2017' -Q "SELECT @@VERSION" || sleep 5
        docker exec -i "${{ job.services.mssql2017.id }}" /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'StrongPassword2017' -Q "CREATE DATABASE test"
        echo "*** SQL Server 2019"
        docker exec -i "${{ job.services.mssql2019.id }}" /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'StrongPassword2019' -C -Q "SELECT @@VERSION" || sleep 5
        docker exec -i "${{ job.services.mssql2019.id }}" /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'StrongPassword2019' -C -Q "CREATE DATABASE test"
        echo "*** SQL Server 2022"
        docker exec -i "${{ job.services.mssql2022.id }}" /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'StrongPassword2022' -C -Q "SELECT @@VERSION" || sleep 5
        docker exec -i "${{ job.services.mssql2022.id }}" /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'StrongPassword2022' -C -Q "CREATE DATABASE test"

https://github.com/keitherskine/pyodbc/actions/runs/10761640943/job/29841067213

keitherskine commented 2 months ago

OK, will do. One sec...

mkleehammer commented 2 months ago

Thanks @keitherskine That was it. I thought 2017 was also failing.

keitherskine commented 2 months ago

No probs @mkleehammer , the Ubuntu CI tests are passing now.