Open williamohara opened 2 years ago
route to CXP team
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @v-anvashist, @V-hmusukula.
Author: | williamohara |
---|---|
Assignees: | - |
Labels: | `Service Attention`, `customer-reported`, `DevOps`, `Pipelines`, `Auto-Assign` |
Milestone: | - |
Removing CXP label for DevOps issue
Adding @v-anvashist, @V-hmusukula. Please look into this
@williamohara, we tried to repro the issue, but we are not successful. Below are the commands we tried in our machine and both commands include the InProgress runs.
Please let me know in which command are you facing the issue as we are not able to repro the issue.
It looks like you are testing in PowerShell - I am in Ubuntu/Linux running on WSL here is my screen shot for az pipelines runs list -o table
and then for az pipelines runs list -o table --top 10
...
I am getting the same thing in my AZ CLI on PS ... This is strange that you aren't able to reproduce it. Could it have something to do with my pipeline jobs? Ican share my azure pipeline yamls if that helps. Just let me know
I have the latest version on PS and v2.32 on Ubuntu
FYI - I upgraded and just tested with the latest version on WSL. I also tried experimenting with my config (setting default outputs) and still the same thing. i also added the project and organization params like you have in your command, same thing...
whenever i put in top 10 parameter it does not show inProgress runs
@williamohara Please help us to get some clarification on the below points.
I have tried all scenarios from both PowerShell and Ubuntu. The images are attached in my previous comments
@williamohara are you using PowerShell on ubuntu or PowerShell on windows?
I am running Ubuntu on WSL. I have the Azure CLI installed on that instance and it does not work. - I also have the Azure CLI installed on my PowerShell as well and it does not work.
I am signing off now. Sorry it's late for me :(
i just tested with a brand new pipeline for a brand new project in a brand new repository. the inProgress runs for that new application show up when I run az pipelines runs list --top 10
.
My new project is an application - its pipeline simply builds a docker container and puts it into ACS
the pipelines that do not show up in the command az pipelines runs list --top 10
are my terraform pipelines that build infrastructure within AKS. My conclusion with this is that there is a problem with the CLI sorting the types of jobs I am running and then filtering them to the top 10. Because they show up when the --top 10
is not used
I have attached a file containing the json of this output az pipelines runs list
without the --top10 filter - the very first one is a job that will show up without the --top 10 filter but when I run the command with the --top10 filter it will not show up. Perhaps you can run it through whatever filter functions you have manually to see if you can replicate the issue that way
outputJson.txt
@williamohara, we tried to repro the issue using terraform pipelines by following the below doc (creation of terraform pipelines etc). https://www.azuredevopslabs.com/labs/vstsextend/terraform/#:~:text=Overview,as%20custom%20in%2Dhouse%20solutions. we are able to see the InProgress run with --top 10 parameter also but all this activity we are performing on our windows machine as we don't have ubuntu/Linux currently. are we missing something in the setup of terraform pipeline?
I use yaml files for all my pipelines. I have attached one, perhaps you could mimic one that is similar. I think the yaml is pretty well structured and easy to follow, but here is a rundown of it,
I do the same thing all over again in a second stage hopefuly this helps
pool:
vmImage: ubuntu-latest
resources:
- repo: self
# Setting up connection to terraform state file stored in Azure Storage.
# variables are stored in the AzureDevops Library named 'Azure DevOps Variable Group Terraform'
variables:
- group: 'Azure DevOps Variable Group Terraform'
# these variables are used for this yaml's context only
- name : anyTfChanges1
value : false
- name : anyTfChanges2
value: false
stages:
- stage: clusterAndDbServerDeployStage1
displayName: 'Deploy Cluster and Database Server'
jobs:
- job: runTerraformCoreInfraStage1
displayName: 'Running Terraform Core-Infra Stage 1'
steps:
- task: TerraformInstaller@0
displayName: 'Installing Terraform'
inputs:
terraformVersion: '1.2.7'
- task: TerraformTaskV2@2
displayName: 'Initializing Terraform for Stage 1'
inputs:
provider: 'azurerm'
command: 'init'
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-1'
backendServiceArm: '$(subscription)'
backendAzureRmResourceGroupName: '$(resourceGroup)'
backendAzureRmStorageAccountName: '$(storageAccount)'
backendAzureRmContainerName: '$(container)'
backendAzureRmKey: '$(tfstateCoreInfraStage1File)'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- task: TerraformTaskV2@2
displayName: 'Create Terraform Plan for Core-Infra Stage 1'
inputs:
provider: 'azurerm'
command: 'plan'
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-1'
commandOptions: '-out=tfplan'
environmentServiceNameAzureRM: '$(subscription)'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- task: PowerShell@2
displayName: 'Updating anyTfChanges1 boolean to true if there are changes'
inputs:
targetType: 'inline'
script: |
# Write-Host "LASTEXITCODE : $LASTEXITCODE"
$plan = $(terraform show -json tfplan | ConvertFrom-Json)
$actions = $plan.resource_changes.change.actions
Write-Host "Terraform actions : $actions"
if (($actions -contains 'create') -or ($actions -contains 'delete') -or ($actions -contains 'update'))
{
Write-Host "Terraform will perform the following actions : $actions"
Write-Host "##vso[task.setvariable variable=anyTfChanges1;]true"
}
else
{
Write-Host "There is no change detected in Terraform tfplan file"
Write-Host "##vso[task.setvariable variable=anyTfChanges1;]false"
}
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-1'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- task: TerraformTaskV2@2
displayName: 'Applying terraform if anyTfChanges1 is true'
condition: eq(variables.anyTfChanges1, true)
inputs:
provider: 'azurerm'
command: 'apply'
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-1'
commandOptions: 'tfplan'
environmentServiceNameAzureRM: '$(subscription)'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- stage: clusterAndDbServerDeployStage2
displayName: 'Core Component Deploy to default Kubernetes namespace'
jobs:
- job: runTerraformCoreInfraStage2
displayName: 'Running Terraform Core-Infra Stage 2'
steps:
#need redundant task to ensure that stages can run independently
- task: TerraformInstaller@0
displayName: Installing Terraform
inputs:
terraformVersion: '1.2.7'
- task: TerraformTaskV2@2
displayName: 'Initializing Terraform for Stage 2'
inputs:
provider: 'azurerm'
command: 'init'
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-2'
backendServiceArm: '$(subscription)'
backendAzureRmResourceGroupName: '$(resourceGroup)'
backendAzureRmStorageAccountName: '$(storageAccount)'
backendAzureRmContainerName: '$(container)'
backendAzureRmKey: '$(tfstateCoreInfraStage2File)'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- task: TerraformTaskV2@2
displayName: 'Create Terraform Plan for Core-Infra Stage 2'
inputs:
provider: 'azurerm'
command: 'plan'
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-2'
commandOptions: '-out=tfplan'
environmentServiceNameAzureRM: '$(subscription)'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- task: PowerShell@2
displayName: 'Updating anyTfChanges2 boolean to true if there are changes'
inputs:
targetType: 'inline'
script: |
# Write-Host "LASTEXITCODE : $LASTEXITCODE"
$plan = $(terraform show -json tfplan | ConvertFrom-Json)
$actions = $plan.resource_changes.change.actions
Write-Host "Terraform actions : $actions"
if (($actions -contains 'create') -or ($actions -contains 'delete') -or ($actions -contains 'update'))
{
Write-Host "Terraform will perform the following actions : $actions"
Write-Host "##vso[task.setvariable variable=anyTfChanges2;]true"
}
else
{
Write-Host "There is no change detected in Terraform tfplan file"
Write-Host "##vso[task.setvariable variable=anyTfChanges2;]false"
}
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-2'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
- task: TerraformTaskV2@2
displayName: 'Applying terraform if anyTfChanges2 is true'
condition: eq(variables.anyTfChanges2, true)
inputs:
provider: 'azurerm'
command: 'apply'
workingDirectory: '$(System.DefaultWorkingDirectory)/stage-2'
commandOptions: 'tfplan'
environmentServiceNameAzureRM: '$(subscription)'
env:
AZDO_ORG_SERVICE_URL: $(azdoOrgServiceUrl)
AZDO_PERSONAL_ACCESS_TOKEN: $(azdoPersonalAccessToken)
Related command az pipelines runs list
Describe the bug this command gives me the top ten runs in a nice table - only its missing the inProgress runs
az pipelines runs list --top 10 -o table
this command works as expected - it gives me 240 runs in a nice table - including the inProgress ones.
To Reproduce submit a run hit the command while the run is running wiht the --top 10 see lack of inProgress
Expected behavior expect to see the inProgress runs too
Environment summary linux, wsl on win 10 { "azure-cli": "2.32.0", "azure-cli-core": "2.32.0", "azure-cli-telemetry": "1.0.6", "extensions": { "aks-preview": "0.5.50", "azure-devops": "0.22.0" } }
Additional context