-
Notifications
You must be signed in to change notification settings - Fork 331
Trigger Kerberos CI from package pipeline #4499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3b05353
Trigger Kerberos tests from package pipeline
paulmedynski bfb26ea
Restructure Kerberos and MI test pipelines
paulmedynski 1bd4292
Avoid tag fetches in upstream alignment checkout (#4499)
paulmedynski 2d952e2
Use current images for MI and Kerberos tests
paulmedynski 6205ef5
Address PR 4499 pipeline review feedback
paulmedynski a48b3b0
Remove Kerberos code coverage stage
paulmedynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #################################################################################################### | ||
| # Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this | ||
| # file to you under the MIT license. See the LICENSE file in the project root for more information. | ||
| #################################################################################################### | ||
|
|
||
| # Configures a Linux agent, joins it to the domain, acquires a Kerberos ticket, and verifies SQL | ||
| # connectivity before running integration tests. | ||
|
|
||
| parameters: | ||
|
|
||
| - name: kerberosDomain | ||
| type: string | ||
|
|
||
| - name: kerberosDomainOU | ||
| type: string | ||
|
|
||
| - name: kerberosDomainUser | ||
| type: string | ||
|
|
||
| - name: kerberosDomainPassword | ||
| type: string | ||
|
|
||
| steps: | ||
|
|
||
| - pwsh: | | ||
| $jdata = Get-Content -Raw "config.default.jsonc" | ConvertFrom-Json | ||
| foreach ($p in $jdata) { | ||
| $p.TCPConnectionString = $env:REMOTE_TCP_CONN_STRING | ||
| $p.NPConnectionString = $env:REMOTE_NP_CONN_STRING | ||
| $p.SupportsIntegratedSecurity = $true | ||
| } | ||
| $jdata | Add-Member -NotePropertyName "KerberosDomainUser" -NotePropertyValue $env:KERBEROS_DOMAIN_USER -Force | ||
| $jdata | Add-Member -NotePropertyName "KerberosDomainPassword" -NotePropertyValue $env:KERBEROS_DOMAIN_PASSWORD -Force | ||
| $jdata | ConvertTo-Json | Set-Content "config.jsonc" | ||
| workingDirectory: src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities | ||
| displayName: Update test config.jsonc (Kerberos) | ||
| env: | ||
| REMOTE_TCP_CONN_STRING: $(REMOTE_TCP_CONN_STRING) | ||
| REMOTE_NP_CONN_STRING: $(REMOTE_NP_CONN_STRING) | ||
| KERBEROS_DOMAIN_USER: ${{ parameters.kerberosDomainUser }} | ||
| KERBEROS_DOMAIN_PASSWORD: ${{ parameters.kerberosDomainPassword }} | ||
|
|
||
| - bash: | | ||
| set -euo pipefail | ||
|
|
||
| DOMAIN="${{ parameters.kerberosDomain }}" | ||
| DOMAIN_OU="${{ parameters.kerberosDomainOU }}" | ||
| DOMAIN_USER="${{ parameters.kerberosDomainUser }}" | ||
| DOMAIN_UPPER=$(echo "$DOMAIN" | tr '[:lower:]' '[:upper:]') | ||
|
|
||
| echo "Domain: $DOMAIN" | ||
| echo "Realm: $DOMAIN_UPPER" | ||
| echo "User: $DOMAIN_USER" | ||
| echo "OU: $DOMAIN_OU" | ||
|
|
||
| if [ -z "$DOMAIN_PASSWORD" ]; then | ||
| echo "##vso[task.logissue type=error]KerberosDomainPassword is empty" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections | ||
|
|
||
| sudo apt-get -y update | ||
| sudo apt-get install -y dialog apt-utils | ||
| sudo apt-get install -y \ | ||
| krb5-user samba sssd sssd-tools libnss-sss libpam-sss \ | ||
| ntp ntpdate realmd adcli | ||
|
|
||
| CURRENT_HOSTNAME="$(hostname)" | ||
| if [ "$CURRENT_HOSTNAME" = "$DOMAIN" ] || [[ "$CURRENT_HOSTNAME" == *".$DOMAIN" ]]; then | ||
| echo "Hostname already uses domain suffix '.$DOMAIN': $CURRENT_HOSTNAME" | ||
| else | ||
| sudo hostnamectl set-hostname "$CURRENT_HOSTNAME.$DOMAIN" | ||
| fi | ||
|
|
||
| if ! sudo grep -Fqx "server $DOMAIN" /etc/ntp.conf; then | ||
| echo "server $DOMAIN" | sudo tee -a /etc/ntp.conf | ||
| fi | ||
| sudo systemctl stop ntp | ||
| sudo ntpdate "$DOMAIN" | ||
| sudo systemctl start ntp | ||
|
|
||
| echo "[libdefaults] | ||
| default_realm = $DOMAIN_UPPER | ||
| rdns = false" | sudo tee /etc/krb5.conf | ||
|
|
||
| sudo realm discover "$DOMAIN_UPPER" | ||
|
|
||
| echo "$DOMAIN_PASSWORD" | sudo realm join --verbose "$DOMAIN_UPPER" \ | ||
| -U "$DOMAIN_USER@$DOMAIN_UPPER" \ | ||
| --computer-ou "OU=$DOMAIN_OU" | ||
|
|
||
| realm list | ||
|
|
||
| echo "$DOMAIN_PASSWORD" | kinit "$DOMAIN_USER@$DOMAIN_UPPER" | ||
|
|
||
| klist | ||
| sudo ip addr | ||
| sudo ip route | ||
| displayName: Initialize Kerberos (domain join + kinit) | ||
| env: | ||
| DOMAIN_PASSWORD: ${{ parameters.kerberosDomainPassword }} | ||
|
|
||
| - pwsh: | | ||
| Install-Module -Name SqlServer -Force -Confirm:$false | ||
| Import-Module SqlServer | ||
| Invoke-Sqlcmd -Query "SELECT @@VERSION, @@SERVERNAME" -ConnectionString $env:REMOTE_TCP_CONN_STRING | ||
| displayName: Verify SQL connectivity | ||
| env: | ||
| REMOTE_TCP_CONN_STRING: $(REMOTE_TCP_CONN_STRING) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should appear as a rename+edit from
linux-init-step.yml, but alas appears as a new file.