-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial add * README.md and cleanup * README update * PR Feedback
- Loading branch information
Showing
33 changed files
with
90,085 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,36 @@ | ||
steps: | ||
- task: docker@2 | ||
displayName: Login to acrbn acr | ||
inputs: | ||
command: login | ||
containerRegistry: 'acrbn-acr' | ||
- task: docker@2 | ||
displayName: Build nginx-recording-test-proxy locally | ||
inputs: | ||
command: build | ||
repository: nginx-recording-test-proxy-dev | ||
dockerfile: 'tests/recordproxy/Dockerfile' | ||
containerRegistry: 'acrbn-acr' | ||
- bash: | | ||
docker images | ||
host_ip=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') | ||
echo "Host IP: $host_ip" | ||
HOST_URL="http://$host_ip:5000" | ||
echo "Host URL: $HOST_URL" | ||
mkdir /logs | ||
docker create -p 5004:5004 --name nginx -v ./logs:/logs -e TEST_PROXY_URL="$HOST_URL" acrbn.azurecr.io/nginx-recording-test-proxy-dev:$(Build.BuildId) | ||
docker start nginx | ||
docker create -p 5001:5001 -p 5000:5000 -v ./tests/recordings:/srv/testproxy --name test-proxy azsdkengsys.azurecr.io/engsys/test-proxy:latest | ||
docker start test-proxy | ||
docker ps | ||
displayName: Run nginx-recording-test-proxy locally | ||
- bash: | | ||
sudo mkdir /ca | ||
sudo chmod 777 /ca | ||
sudo curl -v http://localhost:5004/ca.crt > /ca/ca.crt | ||
sudo mkdir /usr/local/share/ca-certificates/extra | ||
sudo cp /ca/ca.crt /usr/local/share/ca-certificates/extra/ca.crt | ||
sudo dpkg-reconfigure ca-certificates | ||
sudo update-ca-certificates | ||
displayName: Install nginx-recording-test-proxy certificate |
This file contains 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,115 @@ | ||
# This template common steps for building and pushing of dev-carbon images | ||
# Note that this also makes sure we comply with the SBOM requirements even | ||
# though we likely will never use these images beyond the dev/build environment | ||
|
||
variables: | ||
# The base name of the image | ||
# This also matches the suffix of the Dockerfile - ex Dockerfile.ubuntu | ||
baseName: 'ubuntu' | ||
# The version of the the base-named image | ||
baseVer: '20.04' | ||
# The path of the image (should normally not change) | ||
repositorydocker: nginx-recording-test-proxy | ||
dockerfile: 'tests/recordproxy/Dockerfile.base' | ||
version: $(Build.BuildId) | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- main | ||
- refs/tags/* | ||
pr: | ||
- main | ||
|
||
pool: | ||
name: $(UbuntuPipelineName) | ||
|
||
stages: | ||
- stage: SetupStage | ||
jobs: | ||
- job: SetupJob | ||
steps: | ||
- task: Bash@3 | ||
name: Variables | ||
inputs: | ||
filePath: ./.azure/pipelines/scripts/set-variables.sh | ||
arguments: '0.0.0-dev2024.$(Build.BuildId)' | ||
displayName: 'Set up environment variables' | ||
|
||
- stage: DockerStage | ||
dependsOn: SetupStage | ||
jobs: | ||
- job: DockerJob | ||
|
||
steps: | ||
- task: Docker@2 | ||
displayName: Login to ACR | ||
inputs: | ||
containerRegistry: 'acrbn-acr' | ||
command: 'login' | ||
- task: Docker@2 | ||
displayName: Build ($(dockerfile) - $(version)) | ||
inputs: | ||
command: 'build' | ||
containerRegistry: 'acrbn-acr' | ||
repository: $[variables.repositorydocker] | ||
Dockerfile: $(dockerfile) | ||
buildContext: '.' | ||
|
||
################################################################################ | ||
## SBOM | ||
|
||
# So, I have come up with a way to build the SBOM and add it to the image that | ||
# we just built above. It assumes a single tag, but that is just fine as | ||
# we want just a single tag here. | ||
# For the SBOM tool, we need to have a directory to which it writes to | ||
- task: Bash@3 | ||
displayName: 'Make directory for SBOM' | ||
condition: succeeded() | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
mkdir -p "$(System.ArtifactsDirectory)/_SBOM" | ||
# See https://aka.ms/sbom and https://aka.ms/CyberEoM2SBOM | ||
# and specifically https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/secure-supply-chain/ado-sbom-generator | ||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 | ||
displayName: 'SBOM Generation Task' | ||
condition: succeeded() | ||
# What do we do for this? There is no output directory - it is a container build | ||
inputs: | ||
BuildDropPath: '$(System.ArtifactsDirectory)/_SBOM' | ||
|
||
# Show the contents of the SBOM in the build output logs | ||
- task: Bash@3 | ||
displayName: 'View SBOM' | ||
condition: succeeded() | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
echo "Showing the SBOM contents, just because" | ||
for f in $(find "$(System.ArtifactsDirectory)/_SBOM/_manifest" -type f); do | ||
echo | ||
ls -l $f | ||
[[ $f == *.json ]] && sha256sum $f | ||
echo "==== START: $f" | ||
[[ $f == *.json ]] && jq . $f || cat $f | ||
echo | ||
echo "==== END: $f" | ||
echo | ||
done | ||
true | ||
## SBOM | ||
################################################################################ | ||
|
||
- task: Docker@2 | ||
displayName: 'Push ${{ variables.repositorydocker }}' | ||
condition: and(succeeded(), in(variables['Build.Reason'], 'Manual', 'Schedule', 'IndividualCI', 'BatchedCI')) | ||
inputs: | ||
command: 'push' | ||
containerRegistry: 'acrbn-acr' | ||
repository: '$(repositorydocker)' | ||
tags: | | ||
${{ variables.repositorydocker }} | ||
${{ variables.repositorydocker }}-$(Build.BuildId) |
This file contains 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,78 @@ | ||
parameters: | ||
test_adapter_name: Azure.AI.CLI.TestAdapter | ||
TestFilter: 'TestCategory!=SkipOnVSTS' | ||
envToSet: '' | ||
steps: | ||
# ----------------------------------------------------------------------------- | ||
# Run the tests | ||
# ----------------------------------------------------------------------------- | ||
- task: AzureCLI@2 | ||
displayName: Run ai-cli tests | ||
continueOnError: true | ||
inputs: | ||
azureSubscription: 'AI_CLI_TestAdapter' | ||
scriptType: 'bash' | ||
scriptLocation: 'inlineScript' | ||
inlineScript: | | ||
az --version | ||
az account show | ||
cd $(TestResultsPath) | ||
IFS=';' read -ra ENV_VARS <<< "${{ parameters.envToSet }}" | ||
for env_var in "${ENV_VARS[@]}"; do | ||
echo "Setting $env_var" | ||
export "$env_var" | ||
done | ||
echo | ||
echo "Running Docker containers" | ||
docker ps | ||
echo | ||
echo "Current Environment Variables" | ||
env | ||
echo | ||
echo dotnet test --logger trx --results-directory "$(Agent.TempDirectory)" --logger:"trx;LogFileName=$(TestRunTrxFileName)-${{ parameters.test_adapter_name }}.trx" --logger:"console;verbosity=normal" --filter "${{ parameters.TestFilter }}" "$(LocalBinOutputPath)/$(BuildConfiguration)/net8.0/${{ parameters.test_adapter_name }}.dll" | ||
dotnet test --logger trx --results-directory "$(Agent.TempDirectory)" --logger:"trx;LogFileName=$(TestRunTrxFileName)-${{ parameters.test_adapter_name }}.trx" --logger:"console;verbosity=normal" --filter "${{ parameters.TestFilter }}" "$(LocalBinOutputPath)/$(BuildConfiguration)/net8.0/${{ parameters.test_adapter_name }}.dll" | ||
# ----------------------------------------------------------------------------- | ||
# Archive and publish the test run backup artifact | ||
# ----------------------------------------------------------------------------- | ||
- task: ArchiveFiles@2 | ||
displayName: Archive ai-cli-test run backup artifact (build/bin) | ||
continueOnError: true | ||
inputs: | ||
rootFolderOrFile: '$(LocalBinOutputPath)' | ||
includeRootFolder: false | ||
archiveFile: '$(TestBackupArtifactFile)' | ||
replaceExistingArchive: false | ||
|
||
- task: ArchiveFiles@2 | ||
displayName: Archive ai-cli-test run backup artifact (testresults) | ||
continueOnError: true | ||
inputs: | ||
rootFolderOrFile: '$(TestResultsPath)' | ||
includeRootFolder: false | ||
archiveFile: '$(TestBackupArtifactFile)' | ||
replaceExistingArchive: false | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish ai-cli-test run backup artifact | ||
continueOnError: true | ||
retryCountOnTaskFailure: 5 | ||
inputs: | ||
parallel: true | ||
pathToPublish: '$(TestBackupArtifactFile)' | ||
artifactName: TestRunBackup | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Publish the test results | ||
# ----------------------------------------------------------------------------- | ||
- task: PublishTestResults@2 | ||
displayName: Publish ai-cli test results | ||
condition: succeededOrFailed() | ||
inputs: | ||
testRunner: VSTest | ||
testResultsFiles: '$(TestRunTrxFileName)-${{ parameters.test_adapter_name }}.trx' | ||
testRunTitle: '$(TestRunTitle)' | ||
failTaskOnFailedTests: true |
Oops, something went wrong.