GitLab CI/CD deployment with SWA does not execute properly
SWA Version: 1.0.2
Are you accessing the CLI from the default port :4280 ?
- [ ] No, I am using a different port number (
--port) and accessing the CLI from that port - [x] Yes, I am accessing the CLI from port
:4280
Describe the bug
Installing SWA and deploying through gitlab-ci with node:lts-bullseye-slim image gets to - Preparing deployment. Please wait... and then just finishes without any errors, and the code is not deployed.
gitlab-ci.yml
variables:
API_TOKEN: "$DEPLOYMENT_TOKEN"
deploy:
stage: deploy
image: node:lts-bullseye-slim
script:
- npm ci
- npm run build
- npm install -g @azure/static-web-apps-cli
- swa deploy --verbose=silly ./dist -d $API_TOKEN -w ./ --env production
- echo "Done"
Output with --verbose=silly
Running with gitlab-runner 15.2.0~beta.17.g34ae4a68 (34ae4a68)
on blue-5.shared.runners-manager.gitlab.com/default -AzERasQ
Preparing the "docker+machine" executor
Using Docker executor with image node:lts-bullseye-slim ...
Pulling docker image node:lts-bullseye-slim ...
Using docker image sha[2](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L2)56:e90[3](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L3)385156c7[4](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L4)30b[5](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L5)f22d19[6](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L6)49f1e5a4002edefbd7af55ad7e8cfb4dee682292 for node:lts-bullseye-slim with digest node@sha256:022657c913284c97ef636b40a3212e035db94e640a37b10cbf5c4da592499b6d ...
Preparing environment
00:02
Running on runner--azerasq-project-12218079-concurrent-0 via runner-azerasq-shared-1657358274-bd4ef00a...
Getting source from Git repository
00:02
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes...
Initialized empty Git repository in /builds/investlab-ab/investlab-app/.git/
Created fresh repository.
Checking out ca193af2 as azure-static...
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:e903385156c7430b5f22d19649f1e5a4002edefbd7af55ad7e8cfb4dee682292 for node:lts-bullseye-slim with digest node@sha256:022657c913284c97ef636b40a3212e035db94e640a37b10cbf5c4da592499b6d ...
$ npm ci
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.[7](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L7) || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: The project has been renamed to flag-icons
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V[8](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L8) engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
added 1767 packages, and audited 1768 packages in 2m
162 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues possible (including breaking changes), run:
npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
$ npm run build
> [email protected] build
> vue-cli-service build
All browser targets in the browserslist configuration have supported ES module.
Therefore we don't build two separate bundles for differential loading.
- Building for production...
WARNING Compiled with 3 warnings11:20:55 AM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
img/do.f0cade30.svg (385 KiB)
img/do.3[9](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L9)c495d3.svg (382 KiB)
js/chunk-vendors.cd5f0fc6.js (783 KiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.02 MiB)
css/chunk-vendors.4b85a256.css
js/chunk-vendors.cd5f0fc6.js
css/app.59bd4a21.css
js/app.869ce677.js
warning
webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
File Size Gzipped
dist/js/chunk-vendors.cd5f0fc6.js 783.39 KiB 235.43 KiB
dist/js/app.869ce677.js 47.33 KiB 13.71 KiB
dist/css/chunk-vendors.4b85a256.css 164.79 KiB 28.82 KiB
dist/css/app.59bd4a21.css 44.48 KiB 5.70 KiB
Images and other types of assets omitted.
Build at: 2022-07-09T09:20:55.179Z - Hash: 5fddb3eae3b9d3aa - Time: 24473ms
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
$ npm install -g @azure/static-web-apps-cli
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
added 352 packages, and audited 353 packages in 28s
40 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
$ swa deploy --verbose=silly ./dist -d $API_TOKEN -w ./ --env production
Welcome to Azure Static Web Apps CLI (1.0.2)
Getting config file options from swa-cli.config.json...
Config file does not exist at /builds/investlab-ab/investlab-app/swa-cli.config.json
Deploying front-end files from folder:
/builds/investlab-ab/investlab-app/dist
Deployment token provided via flag
- --deployment-token: <hidden>
Deploying to environment: production
Trying to read workflow config with values:
- appLocation: /builds/investlab-ab/investlab-app
- outputLocation: /builds/investlab-ab/investlab-app/dist
- apiLocation: <undefined>
No workflow config folder found at /builds/investlab-ab/investlab-app/.github/workflows
Validating user workflow config (BEFORE):
- appLocation: /builds/investlab-ab/investlab-app
- outputLocation: /builds/investlab-ab/investlab-app/dist
- apiLocation: <undefined>
Validating user workflow config (AFTER):
- appLocation: /builds/investlab-ab/investlab-app
- apiLocation: <undefined>
- outputLocation: /builds/investlab-ab/investlab-app/dist
Loading staticwebapp.config.json schema...
Schema loaded successfully from https://json.schemastore.org/staticwebapp.config.json
Compiling schema...
Reading content from staticwebapp.config.json...
Parsing staticwebapp.config.json...
Validating staticwebapp.config.json...
File validated successfully. Continuing with configuration!
Content parsed successfully
Found configuration file:
/builds/investlab-ab/investlab-app/staticwebapp.config.json
Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
Fetching release metadata for version: stable. Please wait...
- version: stable
- buildId: 1.0.019361
- publishDate: 2022-04-20T15:35:50.4947355Z
- files:
- linux-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/linux/StaticSitesClient
- sha: 24baa1cedd45b7b029f3ee502265de940383fab940e0bed75842cbf7f9030080
- win-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/windows/StaticSitesClient.exe
- sha: 66c529754df158761523aeffcc5f278d14205f6b51afec913ba[11](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L11)3edc3caa681
- osx-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/macOS/StaticSitesClient
- sha: ec26ca4e7a[12](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L12)f46cee93b5d0b2128f79f18a3ff9875d7276a837ca94c[16](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L16)be854
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.0[19](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L19)361/linux/[email protected]
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.019361/linux/[email protected]
Checksum match: 24baa1cedd45b7b029f3ee50[22](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L22)65de940383fab940e0bed75842cbf7f90[30](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L30)080
Saved binary to /root/.swa/deploy/1.0.019[36](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L36)1/StaticSitesClient
Saved metadata to /root/.swa/deploy/StaticSitesClient.json
Deploying using /root/.swa/deploy/1.0.0193[61](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L61)/[email protected][93](https://gitlab.com/investlab-ab/investlab-app/-/jobs/2699615016#L93)61
Deploying using the following options:
- env:
- SWA_CLI_DEBUG: silly
- SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
- SWA_RUNTIME_CONFIG_LOCATION: /builds/investlab-ab/investlab-app
- SWA_RUNTIME_CONFIG: /builds/investlab-ab/investlab-app/staticwebapp.config.json
- SWA_CLI_VERSION: 1.0.2
- SWA_CLI_DEPLOY_DRY_RUN: false
- SWA_CLI_DEPLOY_BINARY: /root/.swa/deploy/1.0.019361/[email protected]
- DEPLOYMENT_ACTION: upload
- DEPLOYMENT_PROVIDER: swa-cli-1.0.2
- REPOSITORY_BASE: /builds/investlab-ab/investlab-app
- SKIP_APP_BUILD: true
- SKIP_API_BUILD: true
- DEPLOYMENT_TOKEN: <hidden>
- APP_LOCATION: /builds/investlab-ab/investlab-app/dist
- API_LOCATION: <undefined>
- CONFIG_FILE_LOCATION: /builds/investlab-ab/investlab-app
- VERBOSE: true
- Preparing deployment. Please wait...
$ echo "Done"
Done
Cleaning up project directory and file based variables
00:01
Job succeeded
To Reproduce
Set up a project with the above specified gitlab-ci.yml and run the pipeline.
Expected behavior Expected process to complete and deploy the code.
EDIT / UPDATE
The issue is only present on -slim distros.
(alpine does not work, but that produces a real error so it's more clear)
Okey, so I tried node:lts-bullseye-slim, node:lts-buster and node:lts-bullseye and the unexpected behavior only occurs on -slim distros. Not sure why, but it works fine on both regular bullseye and buster.
Hey @Tyngstast , if you're using the Gitlab for deploying the Static Web App, we have the CI/CD support for doing that here . Please check if this helps, meanwhile we'll also investigate why you're facing this issue.
I've just encountered another problem, which manifested the same way, though.
Generally, there is a bug with how JS wrapper spawns native binary and hides underlying errors, so it is difficult to see what exactly is going on. Interestingly, process only exits immediately after "Preparing deployment. Please wait..." in non-interactive mode, while in interactive mode it will just keep spinning forever.
@Tyngstast, as for the actual problem you have with -slim images, I believe the hidden error can be fixed by setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT to 1 before call to swa.
My own problem, if anyone is interested, though, was that the native binary that swa downloads is x64, so does not work inside arm image. Looks like there is currently no mention of platform architecture dependence in the docs.
And with -alpine the problem is due to musl use, but I'm surprised @Tyngstast got a real error, as I observe exactly the same behavior as with any other binary compat problems.
We observed the problem on a GitHub self-hosted runner as well.
Runner version: v2.292.0 Runner env:
$ uname -a
Linux github-runner-1cee68b414 5.15.0-1012-azure #15-Ubuntu SMP Fri Jun 10 11:30:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ node -v
v16.15.1
github-ci.yml
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy
run: |
npm install -g @azure/static-web-apps-cli
swa deploy ./dist -d $API_TOKEN -w ./ --env production
We observed the problem on a GitHub self-hosted runner as well.
Runner version: v2.292.0 Runner env:
$ uname -a Linux github-runner-1cee68b414 5.15.0-1012-azure #15-Ubuntu SMP Fri Jun 10 11:30:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux $ node -v v16.15.1github-ci.yml
deploy: runs-on: self-hosted steps: - name: Checkout uses: actions/checkout@v3 - name: Deploy run: | npm install -g @azure/static-web-apps-cli swa deploy ./dist -d $API_TOKEN -w ./ --env production
Downgrading the VM to Linux github-runner-1cee68b414 5.15.0-1014-azure #17~20.04.1-Ubuntu SMP Thu Jun 23 20:01:51 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 20.04-LTS) solved the problem
Okey, so I tried
node:lts-bullseye-slim,node:lts-busterandnode:lts-bullseyeand the unexpected behavior only occurs on-slimdistros. Not sure why, but it works fine on both regularbullseyeandbuster.
Thanks for this! I was using slim and this caught me out.