'Azure DevOps - Static Web Apps failing within a Pipeline with container job
parameters:
- name: App_VariableGroup
type: string
default: my-defaults
values:
- my-defaults
trigger:
- main
pool:
vmImage: ubuntu-latest
container: ubuntu:20.04
variables:
- group: ${{ parameters.App_VariableGroup }}
steps:
- checkout: self
submodules: true
- script: |
echo Hello, world! \n
ls -al
displayName: 'Run a one-line script'
- task: AzureStaticWebApp@0
inputs:
app_location: $(publish_path)
api_location: ''
output_location: ''
skip_app_build: true
azure_static_web_apps_api_token: $(swa_deployment_token)
This code is failing with "container: ubuntu:20.04" and give the following error:
##[warning]Environment variable AGENT_CONTAINERMAPPING is a multiline string and cannot be added to the build environment.
/usr/bin/bash /__w/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.200.0/launch-docker.sh
/__w/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.200.0/launch-docker.sh: line 1: docker: command not found
##[error]Error: The process '/usr/bin/bash' failed with exit code 127
Finishing: AzureStaticWebApp
But the Task: AzureStaticWebApp@0 works fine with just the vmImage and no container.
I remember there is docker:dind concept that I used in gitlab-cicd but could anyone advice on what is going wrong here please?
Solution 1:[1]
One of the problems is that you need docker installed on your container. You may use this guide for how to do that.
However, there is another issue which seems to be a bug in the task itself causing it to fail, possibly related to not being able to load the AGENT_CONTAINERMAPPING environment variable. I ran into this bug myself with an Ubuntu container loaded with docker and other tools specific to my pipeline.
Please reference this bug I submitted to the Microsoft/azure-pipelines-task project for more details and to include your voice.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Aaron Peavy |