Я пытаюсь получить значение userStory от пользователя во время запуска конвейера сборки в Azure DevOps.
Я хочу использовать это значение в качестве переменной в создаваемом мной PHP-скрипте. Я попробовал приведенный ниже код с помощью yaml. Также прилагается ошибка.
trigger:
- main
pool:
vmImage: ubuntu-latest
variables:
phpVersion: 8.1
parameters:
- name: UserStory
displayName: Enter User Story ID.
type: string
default: ''
steps:
- script: |
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
php -version
displayName: 'Use PHP version $(phpVersion)'
- script: |
echo "Running script for user story number $(UserStory)"
export USER_STORY=$(UserStory)
ls -la
php index.php
displayName: 'Run index.php with user story ID'
index.php
PHP Test
Ошибка:
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/abb29e36-8507-4480-aae8-c2995d6af1c8.sh
/home/vsts/work/_temp/abb29e36-8507-4480-aae8-c2995d6af1c8.sh: line 1: UserStory: command not found
/home/vsts/work/_temp/abb29e36-8507-4480-aae8-c2995d6af1c8.sh: line 2: UserStory: command not found
Running script for user story number
total 24
drwxr-xr-x 3 vsts docker 4096 Oct 8 07:26 .
drwxr-xr-x 6 vsts docker 4096 Oct 8 07:26 ..
drwxr-xr-x 8 vsts docker 4096 Oct 8 07:26 .git
-rw-r--r-- 1 vsts docker 985 Oct 8 07:26 README.md
-rw-r--r-- 1 vsts docker 518 Oct 8 07:26 azure-pipelines.yml
-rw-r--r-- 1 vsts docker 210 Oct 8 07:26 index.php
PHP Test
Hello World
User Story Number:
Finishing: Run index.php with user story ID
Подробнее здесь: https://stackoverflow.com/questions/790 ... ure-devops