How do I fix bash in gitlab ci :bad substitution - linux

package.json script block in file:
"scripts": {
...
"test:schema": "./src/schemas/schema-test.sh"
}
.gitlab-ci.yml file contents:
image: node:12
stages:
- lint
- test
# - build
.yarn_install:
before_script:
- yarn config set #private:registry https://npm.private.io
- echo "//npm.private.io/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- yarn install
- export PATH="./node_modules/.bin:${PATH}"
prettier:
stage: lint
script:
- yarn config set #private:registry https://npm.private.io
- echo "//npm.private.io/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- yarn add prettier
- yarn lint
schema test:
stage: test
script:
- yarn test:schema
variables:
GIT_DEPTH: 10
schema-test.sh file contents:
#/usr/bin/env bash
# Test all file ends with schema.json via ajv
CURRENT_DIR=`dirname "$0"`
cd $CURRENT_DIR
for SCHEMA_FILE in *.schema.json
do
SAMPLE_FILE=samples/${SCHEMA_FILE/schema/sample}
echo Schema file: $SCHEMA_FILE
if [ -f $SAMPLE_FILE ]
then
echo Found sample file: $SAMPLE_FILE
npx ajv -s $SCHEMA_FILE -d $SAMPLE_FILE
else
echo "*NO* sample file found for $SCHEMA_FILE"
fi
done
Gitlab CI error message:
...
51 $ export PATH="./node_modules/.bin:${PATH}"
52 $ yarn test:schema
53 yarn run v1.21.1
54 $ ./src/schemas/schema-test.sh
55 ./src/schemas/schema-test.sh: 11: ./src/schemas/schema-test.sh: Bad substitution
56 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
57 error Command failed with exit code 2.
61 ERROR: Job failed: command terminated with exit code 1
The CI error said there was a problem with line 11 of the schema-test.Sh file, but I didn't see the problem.
They work well in a MacOS environment, and my guess is that CI's Docker image is Linux, causing some compatibility issues.
Or is it just a matter of the ' / ' symbol not being Escape Code? I'm confused.
Thank you for all of your help!
==================================================
According to #chepner said to make changes, but the test is still a problem
23 $ yarn test:schema
24 yarn run v1.21.1
25 $ ./src/schemas/schema-test.sh
26 Schema file: dev-assistant.schema.json
27 Found sample file: samples/dev-assistant.sample.json
28 npx: installed 6 in 1.124s
29 command not found: ajv
30 Schema file: form.schema.json
31 *NO* sample file found for form.schema.json
32 Schema file: news.schema.json
33 *NO* sample file found for news.schema.json
34 Schema file: repos.schema.json
35 Found sample file: samples/repos.sample.json
36 npx: installed 6 in 0.911s
37 command not found: ajv
38 Schema file: team-members.schema.json
39 Found sample file: samples/team-members.sample.json
40 npx: installed 6 in 0.902s
41 command not found: ajv
42 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
43 error Command failed with exit code 1.
47 ERROR: Job failed: command terminated with exit code 1

Your script isn't executed with bash, so don't use bash-specific features. Assuming you want to change foo.schema.json to foo.sample.json, you can use instead
SAMPLE_FILE=samples/${SCHEMA_FILE%.schema.json}.sample.json
This removes .schema.json from the expansion of SCHEMA_FILE, then adds .sample.json back explicitly.

Related

Assertion failed: new_time >= loop->time, file c:\ws\deps\uv\src\win\core.c, line 324

PS C:\xampp\htdocs\website> node -v
v18.12.1
PS C:\xampp\htdocs\website> npm -v
8.19.2
PS C:\xampp\htdocs\website> npm run dev
> dev
> vite
VITE v3.2.5 ready in 1227 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
LARAVEL v9.43.0 plugin v0.7.2
➜ APP_URL: http://localhost
Assertion failed: new_time >= loop->time, file c:\ws\deps\uv\src\win\core.c, line 324
PS C:\xampp\htdocs\website> npm run dev
> dev
> vite
Assertion failed: new_time >= loop->time, file c:\ws\deps\uv\src\win\core.c, line 324
I am running vite for laravel.
It works for a while.
After a few minutes it says :Assertion failed
and I run "npm run dev" again
it's the same error
edit:
Currently my solution is
Replace Vite with Mix in Laravel 9.4

DVC | Permission denied ERROR: failed to reproduce stage: failed to run: .py, exited with 126

Goal: run .py files via. dvc.yaml.
There are stages before it, in dvc.yaml, that don't produce the error.
dvc exp run:
(venv) me#ubuntu-pcs:~/PycharmProjects/project$ dvc exp run
Stage 'inference' didn't change, skipping
Running stage 'load_data':
> load_data.py
/bin/bash: line 1: load_data.py: Permission denied
ERROR: failed to reproduce 'load_data': failed to run: load_data.py, exited with 126
dvc repro:
(venv) me#ubuntu-pcs:~/PycharmProjects/project$ dvc repro
Stage 'predict' didn't change, skipping
Stage 'evaluate' didn't change, skipping
Stage 'inference' didn't change, skipping
Running stage 'load_data':
> load_data.py
/bin/bash: line 1: load_data.py: Permission denied
ERROR: failed to reproduce 'load_data': failed to run: pdl1_lung_model/load_data.py, exited with 126
dvc doctor:
DVC version: 2.10.2 (pip)
---------------------------------
Platform: Python 3.9.12 on Linux-5.15.0-46-generic-x86_64-with-glibc2.35
Supports:
webhdfs (fsspec = 2022.5.0),
http (aiohttp = 3.8.1, aiohttp-retry = 2.5.2),
https (aiohttp = 3.8.1, aiohttp-retry = 2.5.2),
s3 (s3fs = 2022.5.0, boto3 = 1.21.21)
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/nvme0n1p5
Caches: local
Remotes: s3
Workspace directory: ext4 on /dev/nvme0n1p5
Repo: dvc, git
dvc exp run -v:
output.txt
dvc exp run -vv:
output2.txt
Solution 1
.py files weren't running as scripts.
They need to be; if you want to run one .py file per stage in dvc.yaml.
To do so, you want to append Boiler-plate code, at the bottom of each .py file.
if __name__ == "__main__":
# invoke primary function() in .py file, w/ params
Solution 2
chmod 777 ....py
Soution 3
I forgot the python in cmd:
load_data:
cmd: python pdl1_lung_model/load_data.py

Failed to create Conda environment status : 143

I am trying to run a nexflow pipeline on some data via the Linux command line, but when I do so, it fails because it fails to create the Conda environment.
It looks like it tries to run the pipeline anyway, despite the environment not being set up properly, and so generates an error message. Any help would be much appreciated. Here is the error message:
Error executing process > 'my_process (1)'
Caused by:
Failed to create Conda environment
command: conda env create --prefix /my_file_path-6bf38a923b48a255f96ea3d66d372e6c --file /my_file_path/environment.yml
status : 143
message:
Here is my environment.yml file:
name: pipeline_name
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- filtlong
- blast==2.5
- minimap2
- samtools
- pysam
- pandas
- matplotlib
- pysamstats
- seaborn
- medaka
- bedtools
- bedops
- seqtk
- bioawk
- sniffles
Not an answer to this question, but if you get a similar failure with a different exit status (120, not 143), try the fix in this thread. Reposting it here:
conda environment from file not working using nextflow · Issue #1081 · nextflow-io/nextflow: https://github.com/nextflow-io/nextflow/issues/1081
pditommaso commented on Mar 18, 2019
The 120 exit status signals that
it was reached the creation timeout. Try increasing it, eg.
conda.createTimeout = '1 h'

Getting NPM error: "Resolving deps of app\app.ts failed."

I'm trying to install and utilize this brunch.io skeleton. I keep running into this error:
20 Apr 19:40:21 - info: application started on http://localhost:3333/
20 Apr 19:40:24 - info: compiling
20 Apr 19:40:28 - error: Resolving deps of app\app.ts failed. Could not load module 'app\home' from 'C:\Users\tyler.WORKGROUP\Documents\GitHub\zenith-folio\app'. Possible solution: add 'app' to package.json and `npm install`.
20 Apr 19:40:28 - error: Resolving deps of app\about\index.ts failed. Could not load module 'app\about\about.tpl' from 'C:\Users\tyler.WORKGROUP\Documents\GitHub\zenith-folio\app\about'. Possible solution: add 'app' to package.json and `npm install`.
20 Apr 19:40:28 - info: compiling.
20 Apr 19:40:29 - info: compiled 477 files into 2 files, copied index.html in 8.4 sec
I'm trying my best to understand what's going on here, but I'm not sure. I can see that I need to add "app" to package.json, but I don't know how or which "app" it's specifying. Is it talking about:
the folder called "app"
a file called app.ts
Or is there something else I'm missing?
Message is pretty clear: Could not load module 'app\home', it means that you have unresolved import in app.ts which possibly looks like import ... from 'app\home';

How to install Material Design Lite Documentation Offline?

I have some problem while installing a documentation for Material Design Lite locally. I have following a command in this file:
git clone https://github.com/google/material-design-lite
cd material-design-lite
npm install && npm install -g gulp
gulp all && gulp serve
When run gulp all there is an error:
root#c54a089ac69c:/home/material-design-lite# gulp all
[21:18:38] Requiring external module babel-register
[21:18:42] Using gulpfile /home/material-design-lite/gulpfile.babel.js
[21:18:42] Starting 'clean'...
[21:18:42] Finished 'clean' after 106 ms
[21:18:42] Starting 'all'...
[21:18:42] Starting 'lint:aux'...
[21:18:45]
/home/material-design-lite/gulpfile.babel.js
136:1 warning Unexpected 'todo' comment no-warning-comments
807:3 warning Unexpected 'todo' comment no-warning-comments
✖ 2 problems (0 errors, 2 warnings)
[21:18:45] Finished 'lint:aux' after 2.39 s
[21:18:45] Starting 'styletemplates'...
[21:18:49] styles all files 1.07 MB
[21:18:49] Finished 'styletemplates' after 4.04 s
[21:18:49] Starting 'styles-grid'...
[21:18:49] Starting 'styles'...
[21:18:49] styles-grid all files 17.77 kB
[21:18:49] Finished 'styles-grid' after 187 ms
[21:18:50] styles all files 714.08 kB
[21:18:50] Finished 'styles' after 1.39 s
[21:18:50] Starting 'styles:gen'...
[21:18:52] Finished 'styles:gen' after 2.36 s
[21:18:52] Starting 'lint:sources'...
[21:18:56]
/home/material-design-lite/src/mdlComponentHandler.js
232:49 error Properties shouldn't be quoted as all quotes are redundant quote-props
366:51 error Properties shouldn't be quoted as all quotes are redundant quote-props
/home/material-design-lite/src/checkbox/checkbox.js
123:5 warning Unexpected 'todo' comment no-warning-comments
/home/material-design-lite/src/icon-toggle/icon-toggle.js
119:5 warning Unexpected 'todo' comment no-warning-comments
/home/material-design-lite/src/radio/radio.js
133:5 warning Unexpected 'todo' comment no-warning-comments
/home/material-design-lite/src/switch/switch.js
122:5 warning Unexpected 'todo' comment no-warning-comments
/home/material-design-lite/src/tabs/tabs.js
88:7 warning Do not use 'new' for side effects no-new
/home/material-design-lite/src/textfield/textfield.js
273:11 warning Unexpected 'todo' comment no-warning-comments
/home/material-design-lite/src/layout/layout.js
520:11 warning Do not use 'new' for side effects no-new
570:3 error Block must not be padded by blank lines padded-blocks
✖ 10 problems (3 errors, 7 warnings)
[21:18:56] 'lint:sources' errored after 3.59 s
[21:18:56] ESLintError in plugin 'gulp-eslint'
Message:
Failed with 3 errors
[21:18:56] 'all' errored after 14 s
[21:18:56] Error in plugin 'run-sequence'
Message:
An error occured in task 'lint:sources'.
But, when I serve it with gulp serve, it's run but just displaying this:
It's Just displaying the files! How to generate offline documentation for material-design-lite? Any ideas? Thanks.
Thank you;
PS:
I run this with on Docker with NodeJS Container.
Material Design Lite Website: https://getmdl.io
I have never try to clone the repo, but with this way i can get the offline docs. Only using wget tools.
wget -mkEpnp https://getmdl.io
And voila, you have the copies of website in your desktop.
As mentioned in the GitHub issue referenced here
You need to checkout with Unix style line endings. This process is detailed in the README.
Windows users, if you have trouble compiling due to line endings then make sure you configure git to checkout the repository with lf (unix) line endings. This can be achieved by setting core.eol.
git config core.eol lf
git config core.autocrlf input
git rm --cached -r .
git reset --hard
The other error
error Properties shouldn't be quoted as all quotes are redundant quote-props
has been fixed for the versions greater than mdl-1.1 as mentioned in the issues here
Hope it helps! Cheers !

Resources