Open dondracek opened 3 years ago
Hi, I am trying to do the same and face the exact same issue. Did you find a solution?
What I want to achieve is that the Azure DevOps build pipelines do the build, publishes the artifact (called drop for example), and then in the Releases theDeploy Azure Static Web App (Preview)
task is used only for deploying to Azure Static Web App.
In the app_location
input I used the drop folder with no luck.
Hi @mud1 , Currently we've managed to get it working by using a bash script:
docker run --entrypoint "/bin/staticsites/StaticSitesClient" --volume "$WORKDIR"/"$ARTIFACTNAME"/"$DISTFOLDER":/root/build mcr.microsoft.com/appsvc/staticappsclient:stable upload --skipAppBuild true --app /root/build --apiToken $DEPLOYMENT_TOKEN
you will need the four variables defined (actually you could put all the 3 WORKDIR, ARTIFACTNAME and DISTFOLDER into one single variable). This works well for me, however doesn't feel right, as any change to the underlying staticsitesclient will lead to a break, that's why I would like to have this issue solved using the dedicated release task.
@dondracek we are currently investigating this issue. Do you mind sharing the full build logs and full yaml file with us?
@mkarmark
Answering your question from the other issue, the only yaml I can pull out of the release pipeline was the one provided.
The release pipeline is triggered by an artifact from our build pipeline that runs on merges. The build pipeline just copies the artifacts over to the staging area.
How much of this would be needed? The artifact is basically the dist folder for the app, so just index.html
css
and javascript
files.
Having same problem.
docker run --entrypoint "/bin/staticsites/StaticSitesClient" --volume "$WORKDIR"/"$ARTIFACTNAME"/"$DISTFOLDER":/root/build mcr.microsoft.com/appsvc/staticappsclient:stable upload --skipAppBuild true --app /root/build --apiToken $DEPLOYMENT_TOKEN
The workaround fixed the problem. Notice that I had to change: --volume "$WORKDIR"/"$ARTIFACTNAME"/"$DISTFOLDER":/root/build
to --volume "$(WORKDIR)/$ARTIFACTNAME/$(DISTFOLDER)":/root/build
the " between the back slashes were causing errors. I also expanded the variables at compile time
This is possibly related to a recent bug in containerd: https://github.com/containerd/containerd/issues/5547
https://developercommunity.visualstudio.com/t/azure-pipeline-fails-with-oci-error/1444539
@dondracek we are currently investigating this issue. Do you mind sharing the full build logs and full yaml file with us?
@mkarmark sure, sorry for the delay: Log:
2021-06-06T07:48:31.2268969Z ##[debug]Evaluating condition for step: 'Deploy static app'
2021-06-06T07:48:31.2270768Z ##[debug]Evaluating: succeeded()
2021-06-06T07:48:31.2271340Z ##[debug]Evaluating succeeded:
2021-06-06T07:48:31.2272596Z ##[debug]=> True
2021-06-06T07:48:31.2273169Z ##[debug]Result: True
2021-06-06T07:48:31.2273723Z ##[section]Starting: Deploy static app
2021-06-06T07:48:31.2282123Z ==============================================================================
2021-06-06T07:48:31.2282482Z Task : Deploy Azure Static Web App
2021-06-06T07:48:31.2282785Z Description : [PREVIEW] Build and deploy an Azure Static Web App
2021-06-06T07:48:31.2283060Z Version : 0.187.1
2021-06-06T07:48:31.2283303Z Author : Microsoft Corporation
2021-06-06T07:48:31.2283554Z Help : https://aka.ms/swadocs
2021-06-06T07:48:31.2283845Z ==============================================================================
2021-06-06T07:48:31.2357638Z ##[debug]Using node path: /home/vsts/agents/2.187.2/externals/node/bin/node
2021-06-06T07:48:31.4411572Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp
2021-06-06T07:48:31.4435378Z ##[debug]loading inputs and endpoints
2021-06-06T07:48:31.4440026Z ##[debug]loading INPUT_APP_LOCATION
2021-06-06T07:48:31.4450990Z ##[debug]loading INPUT_OUTPUT_LOCATION
2021-06-06T07:48:31.4455102Z ##[debug]loading INPUT_API_LOCATION
2021-06-06T07:48:31.4457014Z ##[debug]loading INPUT_ROUTES_LOCATION
2021-06-06T07:48:31.4458775Z ##[debug]loading INPUT_SKIP_APP_BUILD
2021-06-06T07:48:31.4460441Z ##[debug]loading INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN
2021-06-06T07:48:31.4462077Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2021-06-06T07:48:31.4463848Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2021-06-06T07:48:31.4465417Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2021-06-06T07:48:31.4469876Z ##[debug]loading SECRET_DEPLOYMENT_TOKEN
2021-06-06T07:48:31.4472052Z ##[debug]loaded 10
2021-06-06T07:48:31.4498870Z ##[debug]Agent.ProxyUrl=undefined
2021-06-06T07:48:31.4500809Z ##[debug]Agent.CAInfo=undefined
2021-06-06T07:48:31.4501306Z ##[debug]Agent.ClientCert=undefined
2021-06-06T07:48:31.4501805Z ##[debug]Agent.SkipCertValidation=undefined
2021-06-06T07:48:31.4511949Z ##[debug]check path : /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1/task.json
2021-06-06T07:48:31.4516083Z ##[debug]adding resource file: /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1/task.json
2021-06-06T07:48:31.4517225Z ##[debug]system.culture=en-US
2021-06-06T07:48:31.4523030Z ##[debug]which 'bash'
2021-06-06T07:48:31.4531752Z ##[debug]found: '/usr/bin/bash'
2021-06-06T07:48:31.4532417Z ##[debug]which '/usr/bin/bash'
2021-06-06T07:48:31.4532990Z ##[debug]found: '/usr/bin/bash'
2021-06-06T07:48:31.4537875Z ##[debug]testing directory '/home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1'
2021-06-06T07:48:31.4541738Z ##[debug]/usr/bin/bash arg: /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1/launch-docker.sh
2021-06-06T07:48:31.4542413Z ##[debug]args=undefined
2021-06-06T07:48:31.4549284Z ##[debug]app_location=./_E-NEXT_Frontend/dist
2021-06-06T07:48:31.4549800Z ##[debug]app_build_command=undefined
2021-06-06T07:48:31.4556684Z ##[debug]output_location=./
2021-06-06T07:48:31.4560487Z ##[debug]api_location=./
2021-06-06T07:48:31.4561119Z ##[debug]api_build_command=undefined
2021-06-06T07:48:31.4561587Z ##[debug]routes_location=./
2021-06-06T07:48:31.4562050Z ##[debug]skip_app_build=true
2021-06-06T07:48:31.4563576Z ##[debug]azure_static_web_apps_api_token=***
2021-06-06T07:48:31.4572310Z ##[debug]exec tool: /usr/bin/bash
2021-06-06T07:48:31.4572794Z ##[debug]arguments:
2021-06-06T07:48:31.4573573Z ##[debug] /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1/launch-docker.sh
2021-06-06T07:48:31.4577065Z [command]/usr/bin/bash /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1/launch-docker.sh
2021-06-06T07:48:31.7594858Z Unable to find image 'mcr.microsoft.com/appsvc/staticappsclient:stable' locally
2021-06-06T07:48:32.0547214Z stable: Pulling from appsvc/staticappsclient
2021-06-06T07:48:32.0664010Z 1e987daa2432: Pulling fs layer
2021-06-06T07:48:32.0668245Z a0edb687a3da: Pulling fs layer
2021-06-06T07:48:32.0672070Z 6891892cc2ec: Pulling fs layer
2021-06-06T07:48:32.0689264Z 684eb726ddc5: Pulling fs layer
2021-06-06T07:48:32.0693608Z b0af097f0da6: Pulling fs layer
2021-06-06T07:48:32.0697703Z 2ed41dfdfeca: Pulling fs layer
2021-06-06T07:48:32.0713023Z f365d77bcf6d: Pulling fs layer
2021-06-06T07:48:32.0713562Z 25af1a48b49f: Pulling fs layer
2021-06-06T07:48:32.0713897Z e2b88c95fb92: Pulling fs layer
2021-06-06T07:48:32.0714216Z 6a056db05452: Pulling fs layer
2021-06-06T07:48:32.0714514Z 5f9676349597: Pulling fs layer
2021-06-06T07:48:32.0714826Z e626f4616ba2: Pulling fs layer
2021-06-06T07:48:32.0715113Z 684eb726ddc5: Waiting
2021-06-06T07:48:32.0715384Z b0af097f0da6: Waiting
2021-06-06T07:48:32.0715684Z 2ed41dfdfeca: Waiting
2021-06-06T07:48:32.0715952Z f365d77bcf6d: Waiting
2021-06-06T07:48:32.0716220Z 25af1a48b49f: Waiting
2021-06-06T07:48:32.0716505Z e2b88c95fb92: Waiting
2021-06-06T07:48:32.0716771Z 6a056db05452: Waiting
2021-06-06T07:48:32.0717054Z 5f9676349597: Waiting
2021-06-06T07:48:32.0717325Z e626f4616ba2: Waiting
2021-06-06T07:48:32.0717606Z 691b82e2d0a5: Pulling fs layer
2021-06-06T07:48:32.0717918Z 6284ff0d4871: Pulling fs layer
2021-06-06T07:48:32.0718202Z 691b82e2d0a5: Waiting
2021-06-06T07:48:32.0718471Z 6284ff0d4871: Waiting
2021-06-06T07:48:32.5836450Z a0edb687a3da: Verifying Checksum
2021-06-06T07:48:32.5836939Z a0edb687a3da: Download complete
2021-06-06T07:48:33.3785348Z 6891892cc2ec: Verifying Checksum
2021-06-06T07:48:33.3785797Z 6891892cc2ec: Download complete
2021-06-06T07:48:34.6837653Z 1e987daa2432: Verifying Checksum
2021-06-06T07:48:34.6870004Z 1e987daa2432: Download complete
2021-06-06T07:48:35.5057667Z 2ed41dfdfeca: Verifying Checksum
2021-06-06T07:48:35.5069062Z 2ed41dfdfeca: Download complete
2021-06-06T07:48:35.6556454Z f365d77bcf6d: Verifying Checksum
2021-06-06T07:48:35.6556857Z f365d77bcf6d: Download complete
2021-06-06T07:48:36.3914075Z 25af1a48b49f: Verifying Checksum
2021-06-06T07:48:36.3914467Z 25af1a48b49f: Download complete
2021-06-06T07:48:36.6709994Z e2b88c95fb92: Verifying Checksum
2021-06-06T07:48:36.6710468Z e2b88c95fb92: Download complete
2021-06-06T07:48:36.8095166Z 1e987daa2432: Pull complete
2021-06-06T07:48:37.0077004Z 6a056db05452: Verifying Checksum
2021-06-06T07:48:37.0083531Z 6a056db05452: Download complete
2021-06-06T07:48:37.1657837Z 5f9676349597: Verifying Checksum
2021-06-06T07:48:37.1658304Z 5f9676349597: Download complete
2021-06-06T07:48:37.5120137Z e626f4616ba2: Verifying Checksum
2021-06-06T07:48:37.5120583Z e626f4616ba2: Download complete
2021-06-06T07:48:39.7178008Z a0edb687a3da: Pull complete
2021-06-06T07:48:39.9152430Z 6891892cc2ec: Pull complete
2021-06-06T07:48:41.7034718Z 684eb726ddc5: Verifying Checksum
2021-06-06T07:48:41.7035144Z 684eb726ddc5: Download complete
2021-06-06T07:48:42.3699123Z 6284ff0d4871: Verifying Checksum
2021-06-06T07:48:42.3699546Z 6284ff0d4871: Download complete
2021-06-06T07:48:45.4685926Z 684eb726ddc5: Pull complete
2021-06-06T07:48:53.5348397Z 691b82e2d0a5: Verifying Checksum
2021-06-06T07:48:53.5348787Z 691b82e2d0a5: Download complete
2021-06-06T07:49:02.2871279Z b0af097f0da6: Verifying Checksum
2021-06-06T07:49:02.2871990Z b0af097f0da6: Download complete
2021-06-06T07:49:12.2642099Z b0af097f0da6: Pull complete
2021-06-06T07:49:14.4572049Z 2ed41dfdfeca: Pull complete
2021-06-06T07:49:14.5833433Z f365d77bcf6d: Pull complete
2021-06-06T07:49:16.6174620Z 25af1a48b49f: Pull complete
2021-06-06T07:49:16.7278679Z e2b88c95fb92: Pull complete
2021-06-06T07:49:16.8421160Z 6a056db05452: Pull complete
2021-06-06T07:49:16.9708715Z 5f9676349597: Pull complete
2021-06-06T07:49:17.0802625Z e626f4616ba2: Pull complete
2021-06-06T07:49:25.0232011Z 691b82e2d0a5: Pull complete
2021-06-06T07:49:26.2662736Z 6284ff0d4871: Pull complete
2021-06-06T07:49:26.2717524Z Digest: sha256:57b6be4b785eccc666462f284457b72b0c09f6f5e6d067b965750233a417fd0e
2021-06-06T07:49:26.2742405Z Status: Downloaded newer image for mcr.microsoft.com/appsvc/staticappsclient:stable
2021-06-06T07:49:26.4875363Z docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination::/working_dir Type:bind Source:/var/lib/docker/volumes/3d84df3601a3a226dec674d6bdd8a937aaf7761bd6f1a00dc5d9e00af4110691/_data Options:[rbind]}: mount destination :/working_dir not absolute: unknown.
2021-06-06T07:49:26.4932263Z time="2021-06-06T07:49:26Z" level=error msg="error waiting for container: context canceled"
2021-06-06T07:49:26.5002109Z
2021-06-06T07:49:26.5003430Z ##[debug]Exit code 125 received from tool '/usr/bin/bash'
2021-06-06T07:49:26.5004150Z ##[debug]STDIO streams have closed for tool '/usr/bin/bash'
2021-06-06T07:49:26.5057100Z ##[debug]task result: Failed
2021-06-06T07:49:26.5059077Z ##[debug]Processed: ##vso[task.complete result=Failed;]
2021-06-06T07:49:26.5085782Z ##[section]Finishing: Deploy static app
yaml:
steps:
- task: AzureStaticWebApp@0
displayName: 'Deploy static app'
inputs:
app_location: './_E-NEXT_Frontend/dist'
output_location: ./
api_location: ./
routes_location: ./
skip_app_build: true
azure_static_web_apps_api_token: '*****'
Same here. Same YAML works fine in a build pipeline. Logs are almost identical up to a point where release pipeline fails to mount
Same as @MaximBalaganskiy, works fine in build pipeline but mount destination :/working_dir not absolute: unknown
when done through release.
Currently having the same issue. Anyone that has found a fix?
2021-06-30T19:51:53.8326692Z ##[section]Starting: Deploy Static Web App
2021-06-30T19:51:53.8331368Z ==============================================================================
2021-06-30T19:51:53.8331718Z Task : Deploy Azure Static Web App
2021-06-30T19:51:53.8331967Z Description : [PREVIEW] Build and deploy an Azure Static Web App
2021-06-30T19:51:53.8332184Z Version : 0.187.1
2021-06-30T19:51:53.8332377Z Author : Microsoft Corporation
2021-06-30T19:51:53.8332580Z Help : https://aka.ms/swadocs
2021-06-30T19:51:53.8332827Z ==============================================================================
2021-06-30T19:51:54.0177525Z [command]/bin/bash /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.187.1/launch-docker.sh
2021-06-30T19:51:54.2950538Z Unable to find image 'mcr.microsoft.com/appsvc/staticappsclient:stable' locally
2021-06-30T19:51:54.5925405Z stable: Pulling from appsvc/staticappsclient
2021-06-30T19:51:54.5931917Z 1e987daa2432: Pulling fs layer
2021-06-30T19:51:54.5940632Z a0edb687a3da: Pulling fs layer
2021-06-30T19:51:54.5941352Z 6891892cc2ec: Pulling fs layer
2021-06-30T19:51:54.5944931Z 684eb726ddc5: Pulling fs layer
2021-06-30T19:51:54.5945373Z b0af097f0da6: Pulling fs layer
2021-06-30T19:51:54.5945655Z 2ed41dfdfeca: Pulling fs layer
2021-06-30T19:51:54.5945904Z f365d77bcf6d: Pulling fs layer
2021-06-30T19:51:54.5946153Z 25af1a48b49f: Pulling fs layer
2021-06-30T19:51:54.5946438Z e2b88c95fb92: Pulling fs layer
2021-06-30T19:51:54.5946701Z 6a056db05452: Pulling fs layer
2021-06-30T19:51:54.5946962Z 5f9676349597: Pulling fs layer
2021-06-30T19:51:54.5949085Z e626f4616ba2: Pulling fs layer
2021-06-30T19:51:54.5951022Z 691b82e2d0a5: Pulling fs layer
2021-06-30T19:51:54.5952025Z 2c0a0b9b0c9b: Pulling fs layer
2021-06-30T19:51:54.5955120Z 684eb726ddc5: Waiting
2021-06-30T19:51:54.5956691Z b0af097f0da6: Waiting
2021-06-30T19:51:54.5956954Z 2ed41dfdfeca: Waiting
2021-06-30T19:51:54.5957197Z f365d77bcf6d: Waiting
2021-06-30T19:51:54.5958095Z 25af1a48b49f: Waiting
2021-06-30T19:51:54.5960369Z e2b88c95fb92: Waiting
2021-06-30T19:51:54.5962560Z 6a056db05452: Waiting
2021-06-30T19:51:54.5964658Z 5f9676349597: Waiting
2021-06-30T19:51:54.5965925Z e626f4616ba2: Waiting
2021-06-30T19:51:54.5966196Z 691b82e2d0a5: Waiting
2021-06-30T19:51:54.5966437Z 2c0a0b9b0c9b: Waiting
2021-06-30T19:51:54.7661496Z 6891892cc2ec: Verifying Checksum
2021-06-30T19:51:54.7661858Z 6891892cc2ec: Download complete
2021-06-30T19:51:54.8613683Z a0edb687a3da: Verifying Checksum
2021-06-30T19:51:54.8618143Z a0edb687a3da: Download complete
2021-06-30T19:51:55.5116213Z 1e987daa2432: Verifying Checksum
2021-06-30T19:51:55.5128983Z 1e987daa2432: Download complete
2021-06-30T19:51:55.5204508Z 684eb726ddc5: Verifying Checksum
2021-06-30T19:51:55.5205029Z 684eb726ddc5: Download complete
2021-06-30T19:51:55.6718112Z f365d77bcf6d: Verifying Checksum
2021-06-30T19:51:55.6718777Z f365d77bcf6d: Download complete
2021-06-30T19:51:56.1719178Z 2ed41dfdfeca: Verifying Checksum
2021-06-30T19:51:56.1719522Z 2ed41dfdfeca: Download complete
2021-06-30T19:51:56.3265969Z e2b88c95fb92: Verifying Checksum
2021-06-30T19:51:56.3266368Z e2b88c95fb92: Download complete
2021-06-30T19:51:56.4189735Z 25af1a48b49f: Verifying Checksum
2021-06-30T19:51:56.4190126Z 25af1a48b49f: Download complete
2021-06-30T19:51:56.4729750Z 6a056db05452: Verifying Checksum
2021-06-30T19:51:56.4733047Z 6a056db05452: Download complete
2021-06-30T19:51:56.5610925Z 5f9676349597: Verifying Checksum
2021-06-30T19:51:56.5611265Z 5f9676349597: Download complete
2021-06-30T19:51:56.6041198Z e626f4616ba2: Verifying Checksum
2021-06-30T19:51:56.6043398Z e626f4616ba2: Download complete
2021-06-30T19:51:57.1735119Z 2c0a0b9b0c9b: Verifying Checksum
2021-06-30T19:51:57.1735555Z 2c0a0b9b0c9b: Download complete
2021-06-30T19:51:57.6741011Z b0af097f0da6: Verifying Checksum
2021-06-30T19:51:57.6750284Z b0af097f0da6: Download complete
2021-06-30T19:51:58.2614534Z 691b82e2d0a5: Verifying Checksum
2021-06-30T19:51:58.2614880Z 691b82e2d0a5: Download complete
2021-06-30T19:51:58.7489668Z 1e987daa2432: Pull complete
2021-06-30T19:52:01.3458179Z a0edb687a3da: Pull complete
2021-06-30T19:52:01.4995782Z 6891892cc2ec: Pull complete
2021-06-30T19:52:03.9019033Z 684eb726ddc5: Pull complete
2021-06-30T19:52:12.3494104Z b0af097f0da6: Pull complete
2021-06-30T19:52:14.1909951Z 2ed41dfdfeca: Pull complete
2021-06-30T19:52:14.2823983Z f365d77bcf6d: Pull complete
2021-06-30T19:52:15.9515741Z 25af1a48b49f: Pull complete
2021-06-30T19:52:16.0332669Z e2b88c95fb92: Pull complete
2021-06-30T19:52:16.1252614Z 6a056db05452: Pull complete
2021-06-30T19:52:16.2246646Z 5f9676349597: Pull complete
2021-06-30T19:52:16.3202767Z e626f4616ba2: Pull complete
2021-06-30T19:52:23.1947690Z 691b82e2d0a5: Pull complete
2021-06-30T19:52:24.2879041Z 2c0a0b9b0c9b: Pull complete
2021-06-30T19:52:24.2914427Z Digest: sha256:fc9db23777aea0ee404885f29ebc56305d016304b9ec07a3cd823d132016288b
2021-06-30T19:52:24.2927121Z Status: Downloaded newer image for mcr.microsoft.com/appsvc/staticappsclient:stable
2021-06-30T19:52:24.4608932Z docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination::/working_dir Type:bind Source:/var/lib/docker/volumes/9953670cf7df7235fb8fe243a128fc411845e7f9e35724e208e7cbb876f9324b/_data Options:[rbind]}: mount destination :/working_dir not absolute: unknown.
2021-06-30T19:52:24.4610674Z time="2021-06-30T19:52:24Z" level=error msg="error waiting for container: context canceled"
2021-06-30T19:52:24.4686514Z
2021-06-30T19:52:24.4719029Z ##[section]Finishing: Deploy Static Web App
YAML
steps:
- task: AzureStaticWebApp@0
displayName: 'Deploy Static Web App'
inputs:
app_location: '"./"'
skip_app_build: true
azure_static_web_apps_api_token: '<redacted>'
EDIT:
Currently using a workaround mentioned by @igi-dawli, by just using the following docker command-line task in an ubuntu-18.04 agent job:
docker run --entrypoint "/bin/staticsites/StaticSitesClient" --volume "$(System.DefaultWorkingDirectory)/ArtifactDirectory/ArtifactName":/root/build mcr.microsoft.com/appsvc/staticappsclient:stable upload --skipAppBuild true --app /root/build --apiToken $DEPLOYMENT_TOKEN
Just make sure the bind volume path is correct ("$(System.DefaultWorkingDirectory)/ArtifactDirectory/ArtifactName"
part).
See also this workaround that's been shared on the PR that addresses this issue with the task: https://github.com/microsoft/azure-pipelines-tasks/pull/14807#issuecomment-868593099
---EDIT I had many errors in my pipeline yaml file. I also followed @anthonychu suggestion and was able to get it working as expected.
--- ORIGINAL Hey everyone, I currently also have a Pipeline that builds a NextJS project and publish the artficat. Here's the relevant YAML:
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '14.17.1'
displayName: 'Install Node.js'
- task: Bash@3
displayName: Build
inputs:
targetType: 'inline'
script: |
npm install
npm run build
env:
NEXT_PUBLIC_AZURE_IMAGE_STORAGE_BASE_URL: '$(NEXT_PUBLIC_AZURE_IMAGE_STORAGE_BASE_URL)'
NEXT_PUBLIC_CLOUDFLARE_DOMAIN: '$(NEXT_PUBLIC_CLOUDFLARE_DOMAIN)'
- stage: Artifact
displayName: Artifact stage
jobs:
- job: Artifact
displayName: Publish artifact
pool:
vmImage: ubuntu-latest
steps:
- task: PublishBuildArtifacts@1
- publish: $(Build.ArtifactStagingDirectory)/WebApp
artifact: drop
- download: current
artifact: drop
And here's the bash script I use in the Release pipeline.
docker run --entrypoint "/bin/staticsites/StaticSitesClient" --volume "$(System.DefaultWorkingDirectory)/WebApp/drop":/root/build mcr.microsoft.com/appsvc/staticappsclient:stable upload --skipAppBuild true --app /root/build --apiToken $DEPLOYMENT_TOKEN
And here's the log from the Release pipeline. I don't think I'm getting the right folder pointed out? Or am I doing something wrong with the publish artifact step on the pipeline?
2021-07-05T16:50:57.4519734Z Status: Downloaded newer image for mcr.microsoft.com/appsvc/staticappsclient:stable
2021-07-05T16:50:57.9565149Z [37mDeploymentId: 5e916cea-d7c7-4a53-b04b-b7444b191d46[0m
2021-07-05T16:50:57.9565831Z [37m[0m
2021-07-05T16:50:58.1025222Z [37mApp Directory Location: '/root/build' was found.[0m
2021-07-05T16:50:58.1025825Z [37mNo Api directory specified. Azure Functions will not be created.[0m
2021-07-05T16:50:58.8486734Z [37mSkipping step to build /root/build with Oryx[0m
2021-07-05T16:50:58.8511880Z [31mFailed to find a default file in the app artifacts folder (root/build). Valid default files: index.html,Index.html.[0m
2021-07-05T16:50:58.8512752Z [31mIf your application contains purely static content, please verify that the variable 'app_location' in your workflow file (located in .github/workflows) points to the root of your application.[0m
2021-07-05T16:50:58.8513591Z [31mIf your application requires build steps, please validate that a default file exists in the build output directory.[0m
2021-07-05T16:50:58.8514055Z [31m[0m
2021-07-05T16:50:58.9048672Z [37m[0m
2021-07-05T16:50:58.9049448Z [33mFor further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/[0m
2021-07-05T16:50:58.9050500Z [33mIf you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/[0m
2021-07-05T16:50:58.9051041Z [33mExiting[0m
2021-07-05T16:50:59.0458590Z ##[error]Bash exited with code '1'.
2021-07-05T16:50:59.0533234Z ##[section]Finishing: Deploy Static Web App
Thanks all
Same error from the release pipeline:
2021-08-19T16:46:26.3710216Z ==============================================================================
2021-08-19T16:46:26.3710566Z Task : Deploy Azure Static Web App
2021-08-19T16:46:26.3710862Z Description : [PREVIEW] Build and deploy an Azure Static Web App
2021-08-19T16:46:26.3711106Z Version : 0.187.1
2021-08-19T16:46:26.3711311Z Author : Microsoft Corporation
2021-08-19T16:46:26.3711543Z Help : https://aka.ms/swadocs
2021-08-19T16:46:26.3711829Z ==============================================================================
2021-08-19T16:46:27.1580955Z [command]"C:\Program Files\Git\bin\bash.exe" D:\a\_tasks\AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a\0.187.1\launch-docker.sh
2021-08-19T16:46:30.8593608Z Unable to find image 'mcr.microsoft.com/appsvc/staticappsclient:stable' locally
2021-08-19T16:46:31.9420526Z stable: Pulling from appsvc/staticappsclient
2021-08-19T16:46:32.1720766Z docker: image operating system "linux" cannot be used on this platform.
2021-08-19T16:46:32.1722143Z See 'docker run --help'.
2021-08-19T16:46:32.1892084Z
2021-08-19T16:46:32.2138290Z ##[section]Finishing: Deploy Static Web App
Thank you
@Sergey-Nosov-GH Looks like your build agent is running Windows. This task can only be run on Linux agents at this time.
For those of you trying to use the task from a release pipeline, version 0.187.1 should contain a fix that uses the correct default directory. You can also override the working directory using the workingDirectory
input.
Keep in mind that app_location
and api_location
are relative to the working directory. It won't work if you put an absolute path in there.
@anthonychu please explain where do I have an error in my logic?
My source code located in git - Azure DevOps I have a build pipeline that has the following steps:
I need "Deploy Azure Static Web App" to build my static website. And I need dacpac task - so that azure functions can save data to db.
How I suppose to behave if 2 tasks can only run on opposite platforms? What I'm missing here?
Hi, I've been trying to do a deployment from a release pipeline by using the preview "Build and deploy an Azure Static Web App" Preview task (v.0.187.1). The app is already built using a build pipeline, so I only want to push it to the azure web app. I already tried a lot of setting, but I always get the following error:
What am I doing wrong?