Open rodchenkov opened 2 years ago
Hi @rodchenkov you can define pipeline variables by this article: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch
Your case will be like:
variables:
CI_DIR: $(Pipeline.Workspace)/ci # here you define pipeline variable
stages:
- stage: Dev
displayName: 'Dev'
jobs:
deployment: Deploy
displayName: 'Deploy'
pool:
vmImage: 'ubuntu-latest'
environment: 'Dev'
strategy:
runOnce:
deploy:
steps:
- task: AzureStaticWebApp@0
inputs:
workingDirectory: $(CI_DIR) # here you use it
app_location: '/project'
skip_app_build: true
skip_api_build: true
azure_static_web_apps_api_token: '$(devMainStaticWebAppApiKey)'
Is this solution fits your case?
Hi @KonstantinTyukalov and thanks for your help. Variable is nice option, but looks like what I really need is to understand how to get name of pipeline from witch we are getting artifacts. What I found is that name of pipeline is same as name of folder to witch our CD downloads artifacts. As you can see in code below in resources we have pipelines with one pipeline named ci Later during download step we can see that subfolder for artifacts with same ci name created so we are getting this path '/home/vsts/work/1/ci/...'
Do we have any options to get name of pipeline or shall I just use variable with manual setup as you mentioned before?
` trigger: none
resources: pipelines:
variables:
stages:
When using deployment job in yaml the artifacts from CI pipeline downloaded to '/home/vsts/work/1/ci/...' How to get this path as variable in pipeline?
Starting: Download Artifact
Task : Download build artifacts Description : Download files that were saved as artifacts of a completed build Version : 0.200.1 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/download-build-artifacts
Downloading artifacts for build: 4724 Downloading items from container resource #/21772323/project Downloading artifact project from: https://dev.azure.com/aurochses//_apis/resources/Containers/21772323?itemPath=project&isShallow=true&api-version=4.1-preview.4 Downloading project/3rdpartylicenses.txt to /home/vsts/work/1/ci/project/3rdpartylicenses.txt Downloaded project/3rdpartylicenses.txt to /home/vsts/work/1/ci/project/3rdpartylicenses.txt Downloading project/favicon.ico to /home/vsts/work/1/ci/project/favicon.ico Downloaded project/favicon.ico to /home/vsts/work/1/ci/project/favicon.ico Downloading project/index.html to /home/vsts/work/1/ci/project/index.html Downloaded project/index.html to /home/vsts/work/1/ci/project/index.html Downloading project/main.06b493153b659fa5.js to /home/vsts/work/1/ci/project/main.06b493153b659fa5.js Downloaded project/main.06b493153b659fa5.js to /home/vsts/work/1/ci/project/main.06b493153b659fa5.js Downloading project/polyfills.f04764812ed2518a.js to /home/vsts/work/1/ci/project/polyfills.f04764812ed2518a.js Downloaded project/polyfills.f04764812ed2518a.js to /home/vsts/work/1/ci/project/polyfills.f04764812ed2518a.js Downloading project/runtime.231e96734c9fdc57.js to /home/vsts/work/1/ci/project/runtime.231e96734c9fdc57.js Downloaded project/runtime.231e96734c9fdc57.js to /home/vsts/work/1/ci/project/runtime.231e96734c9fdc57.js Downloading project/styles.ef46db3751d8e999.css to /home/vsts/work/1/ci/project/styles.ef46db3751d8e999.css Downloaded project/styles.ef46db3751d8e999.css to /home/vsts/work/1/ci/project/styles.ef46db3751d8e999.css Total Files: 7, Processed: 7, Skipped: 0, Failed: 0, Download time: 1.009 secs, Download size: 79505Bytes Successfully downloaded artifacts to /home/vsts/work/1/ci Finishing: Download Artifact
yaml example
stages:
Thank you