Azure / sql-action

🚀 Deploy changes to your SQL database easily with SQL projects or SQL scripts and sql-action for GitHub workflows
MIT License
99 stars 54 forks source link

Error: No credentails found. Add an Azure login script before this action. #209

Open joe-schmirler opened 7 months ago

joe-schmirler commented 7 months ago

Using Azure/sql-action@v2.2 to deploy scripts to on-premises SQL Server 2019 using a sql authenticated account. I am not using Azure in any way. I can have a successful deploy of a .sql script one run, and the next run that same script/execution can fail, and keep failing reruns, and then just randomly be successful.

The error is: Error: No credentails found. Add an Azure login script before this action.

"credentails" is not a spelling error on my end, that is the copy/pasted error from GitHub Actions workflow. In bin/main.js, you can search for "credentails" to see the chunk of code that it is erroring due to something within the code.

I find it strange behavior that with the exact same setup one run will be successful, the next one will fail (and sometimes fail dozens of times in a row), and then randomly will be successful again.

Has anyone else seen this behavior/error message?

- name: Deploy Script A
        uses: Azure/sql-action@v2.2
        with:
          connection-string: "${{ secrets.CONNECTION_STRING }}"
          path: './sqlscripts/scriptA.sql'
          arguments: -b

- name: Deploy Script B
        uses: Azure/sql-action@v2.2
        with:
          connection-string: "${{ secrets.CONNECTION_STRING }}"
          path: './sqlscripts/scriptB.sql'
          arguments: -b

I turned debug mode on and captured the output. Scenario: the GitHub workflow executes 2 scripts with the above code above, back to back. Same connection string and script contents (select 'Testing debug'), just in separate scripts to catch a success and a failure in the same workflow.

The '.' in the failed attempt at the beginning of the line means it's the same as the successful log. Here are the logs right before the azure/sql-action kicks off:

SUCCESS - deploy scriptA to AdventureWorks database on sql-server1.domain.com:1433

[debug]isExplicit: 1.0.0

[debug]explicit? true

[debug]checking cache: /opt/hostedtoolcache/go-sqlcmd/1.0.0/x64

[debug]not found

[debug]Downloading https://github.com/microsoft/go-sqlcmd/releases/download/v1.0.0/sqlcmd-v1.0.0-linux-x64.tar.bz2

[debug]Destination /home/gaction/actions-runner/_work/_temp/751ab65d-c2e3-46b2-8d80-4fccce6751ad

[debug]download complete

[debug]Checking tar --version

[debug]tar (GNU tar) 1.34

[debug]Copyright (C) 2021 Free Software Foundation, Inc.

[debug]License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html.

[debug]This is free software: you are free to change and redistribute it.

[debug]There is NO WARRANTY, to the extent permitted by law.

[debug]

[debug]Written by John Gilmore and Jay Fenlason.

tar xj -v --warning=no-unknown-keyword --overwrite -C /home/gaction/actions-runner/_work/_temp/c655f6ad-76f2-4fdf-9e30-61e77e092f39 -f /home/gaction/actions-runner/_work/_temp/8a3e0d22-c11d-418c-a2d5-d04a4cbcb575 NOTICE.md sqlcmd sqlcmd_debug

[debug]Caching tool go-sqlcmd 1.0.0 x64

[debug]source dir: /home/gaction/actions-runner/_work/_temp/c655f6ad-76f2-4fdf-9e30-61e77e092f39

[debug]destination /opt/hostedtoolcache/go-sqlcmd/1.0.0/x64

[debug]finished caching tool

[debug]Get action inputs.

::add-mask:: ::add-mask::

[debug]Validating if client has access to 'master' on 'sql-server1.domain.com'.

[debug]Begin executing sql script

sqlcmd -S sql-server1.domain.com -d AdventureWorks -U *** -i ./sqlscripts/scriptA.sql -b

Output Testing debug

(1 row affected) Successfully executed SQL file on target database.


FAIL - deploy scriptB to AdventureWorks database on sql-server1.domain.com:1433 . ##[debug]isExplicit: 1.0.0 . ##[debug]explicit? true . ##[debug]checking cache: /opt/hostedtoolcache/go-sqlcmd/1.0.0/x64 . ##[debug]not found . ##[debug]Downloading https://github.com/microsoft/go-sqlcmd/releases/download/v1.0.0/sqlcmd-v1.0.0-linux-x64.tar.bz2 . ##[debug]Destination /home/gaction/actions-runner/_work/_temp/751ab65d-c2e3-46b2-8d80-4fccce6751ad . ##[debug]download complete . ##[debug]Checking tar --version . ##[debug]tar (GNU tar) 1.34 . ##[debug]Copyright (C) 2021 Free Software Foundation, Inc. . ##[debug]License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. . ##[debug]This is free software: you are free to change and redistribute it. . ##[debug]There is NO WARRANTY, to the extent permitted by law. . ##[debug] . ##[debug]Written by John Gilmore and Jay Fenlason. . tar xj -v --warning=no-unknown-keyword --overwrite -C /home/gaction/actions-runner/_work/_temp/45f3bd31-9bf4-4851-8faa-11cd2b3c0bab -f /home/gaction/actions-runner/_work/_temp/751ab65d-c2e3-46b2-8d80-4fccce6751ad . NOTICE.md . sqlcmd . sqlcmd_debug . ##[debug]Caching tool go-sqlcmd 1.0.0 x64 . ##[debug]source dir: /home/gaction/actions-runner/_work/_temp/45f3bd31-9bf4-4851-8faa-11cd2b3c0bab . ##[debug]destination /opt/hostedtoolcache/go-sqlcmd/1.0.0/x64 . ##[debug]finished caching tool . ##[debug]Get action inputs. . ::add-mask:: . ::add-mask:: . ##[debug]Validating if client has access to 'master' on 'sql-server1.domain.com'.

[debug]The process 'sqlcmd' failed with exit code 1

[debug]SqlCmd stderr: unable to open tcp connection with host 'sql-server1.domain.com:1433': dial tcp ip.ad.dre.ss:1433: i/o timeout

[debug]unable to open tcp connection with host 'sql-server1.domain.com:1433': dial tcp ip.ad.dre.ss:1433: i/o timeout

[debug]

[debug]try-get AzureCLIAuthorizer

[debug]{}

Error: No credentails found. Add an Azure login script before this action.

[debug]Node Action run completed with exit code 1

[debug]AZURE_HTTP_USER_AGENT='GITHUBACTIONS_AzureSqlAction_5a2680ec296d517622edbc0a559bf3fb603c4c653bc14cc5d46f5ffc1f2f4e6e'

[debug]SQLCMDPASSWORD='***'

[debug]AZURE_HTTP_USER_AGENT=''

[debug]Finishing: Deploy to Target

@jongilmorejr - tagging because your name is in the debug logs :)

github-actions[bot] commented 6 months ago

This issue is idle because it has been open for 14 days with no activity.

tamer-abdulghani commented 5 months ago

we are facing the same issue same error as seen in picture below. It was working fine 2 weeks ago. Nothing has changed at all. Any idea ?

image001

github-actions[bot] commented 4 months ago

This issue is idle because it has been open for 14 days with no activity.