I am trying to lint only the pushed files but the following yaml file only validates the whole codebase not the pushed file.
trigger:
- development-test
pool:
vmImage: ubuntu-latest
stages:
- stage: PreDeployment
jobs:
- job: Code_Validation
steps:
- script: |
docker pull github/super-linter:latest
displayName: Pull github/super-linter docker image
- script: |
docker run \
-e VALIDATE_CODE_BASE=false
-v $(System.DefaultWorkingDirectory):/tmp/lint github/super-linter
displayName: super-linter validation
Your env VALIDATE_CODE_BASE should be VALIDATE_ALL_CODEBASE
from https://github.com/github/super-linter#environment-variables :
ENV VAR
Default Value
Notes
...
...
...
VALIDATE_ALL_CODEBASE
true
Will parse the entire repository and find all files to validate across all types. NOTE: When set to false, only new or edited files will be parsed for validation.
...
...
...
Related
i was trying to add circle ci in my branch because i have many branches and i added circleci and config file lite this :
version: 2.1
orbs:
node: circleci/node#5.0.2
heroku: circleci/heroku#1.2.6
jobs:
build_and_test:
executor: node/default
steps:
- checkout
- node/install-packages:
pkg-manager: npm
- run:
command: npm run test
name: Run tests
- run:
command: npm run build
name: Build app
- persist_to_workspace:
root: ~/project
paths:
- .
deploy: # this can be any name you choose
executor: heroku/default
steps:
- attach_workspace:
at: ~/project
- heroku/deploy-via-git:
force: true # force push when pushing to the heroku remote, see: https://devcenter.heroku.com/articles/git
workflows:
test_my_app:
jobs:
- build_and_test
- deploy:
requires:
- build_and_test # only deploy if the build_and_test job has completed
filters:
branches:
only: main
# only: main # only deploy when on main
this was the error from circle ci:
ERROR IN CONFIG FILE:
[#/workflows/test_my_app] only 1 subschema matches out of 2
1. [#/workflows/test_my_app/jobs/1] 0 subschemas matched instead of one
| 1. [#/workflows/test_my_app/jobs/1] expected type: String, found: Mapping
| | SCHEMA:`
this was the error from circle ci:
ERROR IN CONFIG FILE:
[#/workflows/test_my_app] only 1 subschema matches out of 2
1. [#/workflows/test_my_app/jobs/1] 0 subschemas matched instead of one
| 1. [#/workflows/test_my_app/jobs/1] expected type: String, found: Mapping
| | SCHEMA:**strong text**`
You need to indent the line only: main (the one just below branches). See examples of the correct formatting here.
I'm using a little bit of Javascript in my Blazor app to do some light work. Everything works fine on my local computer. When I publish to my Azure Static Web App, the Javascript does not execute. Here is the error message.
Refused to execute script from 'https://fullUrl/js.download' because its MIME type ('application/octet-stream') is not executable, and strict MIME type checking is enabled.
Here is my yaml file.
trigger:
- main
pool:
vmImage: ubuntu-latest
# vmImage: windows-latest
steps:
- checkout: self
submodules: true
- task: DotNetCoreCLI#2
inputs:
command: 'publish'
publishWebProjects: true
- task: AzureStaticWebApp#0
inputs:
app_location: '/'
api_location: ''
output_location: 'wwwroot'
azure_static_web_apps_api_token: $(deployment_token)
I placed this in my staticwebapp.config.json file.
"mimeTypes": {
".json": "text/json",
".js": "application/octet-stream"
}
Does anyone know how to get this to work? Thanks!
I finally got all of this to work. I renamed myfile.js.download to just myfile.js. I then changed another js file to js.js. Anyway, that seemed to be the change that was needed.
Here is the updated yaml file.
trigger:
- master
pool:
vmImage: ubuntu-latest
# vmImage: windows-latest
steps:
- task: DotNetCoreCLI#2
displayName: 'dotnet build'
inputs:
command: 'build'
arguments: '--configuration Release'
projects: 'YourProjectName.csproj'
- task: DotNetCoreCLI#2
displayName: 'dotnet publish'
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration Release'
zipAfterPublish: false
- task: AzureStaticWebApp#0
inputs:
skip_app_build: true
app_location: '/bin/Release/net5.0/publish/wwwroot'
output_location: ''
azure_static_web_apps_api_token: 'YOURDEPLOYMENTTOKEN'
My problem is that I need to increase max_payload value that NATS receive but I have no idea where I can do it.
The project is using Moleculer and NATS is created as a container with docker.
When I try to make a request which is bigger than 1MB NATS returns:
ERROR - NATS error. 'Maximum Payload Violation
Inside dockstation logs NATS returns:
cid:1 - maximum payload exceeded: 1341972 vs 1048576
I tried the following items:
Changing tranporter inside Moleculer Broker configs (https://moleculer.services/docs/0.12/transporters.html);
Add an config file for NATS to modify some options (https://hub.docker.com/_/nats);
Code example of Moleculer Broker configs:
const brokerConfig: BrokerOptions = {
...,
transporter: "NATS",
transit: {
maxQueueSize: 100000,
disableReconnect: false,
disableVersionCheck: false,
},
...
}
Code example of nats config file:
{
max_payload: 1000000
}
Error when I run docker with NATS config file:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/home/matheus/nats-server.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/08959b2fce0deb2abea27e103f7f4426b7ed6f3ef64b214f713ebb993c2373e6/merged\\\" at \\\"/var/lib/docker/overlay2/08959b2fce0deb2abea27e103f7f4426b7ed6f3ef64b214f713ebb993c2373e6/merged/nats-server.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. error Command failed with exit code 125.
You should create a configuration file for NATS. And push it to the container as a Docker volume and set the command as -c nats-server.conf
nats-server.conf
max_payload: 4Mb
Start container
docker run -d -p 4222:4222 -v ~/nats-server.conf:/nats-server.conf nats -c /nats-server.conf
I have setup the fastify framework with fastify-cli library with command fastify-cli generate. It has fastify-autoload plugin used out of the box.
But, it will throw an error when I add my own service with exception for model.js and schema.js files.
...
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'services'),
options: Object.assign({}, opts),
ignorePattern: /.*(model|schema)\.js/
})
...
Error message:
assert.js:788
throw newErr;
^
AssertionError [ERR_ASSERTION]: ifError got unwanted exception: plugin must be a function
at wrap (D:\project\kuisioner\backend\node_modules\fastify-cli\start.js:124:5)
...
actual: Error: plugin must be a function
...
error Command failed with exit code 1.
...
But it will run smoothly when I register it manually
...
fastify.register(require('./services/quiz/get'))
fastify.register(require('./services/quiz/post'))
...
My file structure:
- src
- plugins
- db.js
- services
| - quiz
| - get.js
| - model.js
| - post.js
| - schema.js
- app.js
I use fastify-cli fastify start -l info src/app.js to run my code
Here's my repo https://github.com/nnfans/kuisionerid_backend
Checking your repo the error is the dir value. You must point to the dir with the files, it is not supported the recursive loading yet
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'services/quiz'),
options: Object.assign({}, opts),
ignorePattern: /.*(model|schema)\.js/
})
With this change, the npm start will work.
Another option is to use module.exports.autoload = false in the files that need to be skipped, but your regex is ok.
if you got here and you use typescript, maybe try to delete the dist dir and re-run tsc, you might have had a bad route that persisted there
I am starting instances of my app as a package.json script with PM2 this way:
"start:pm2": "pm2 start -i max node myapp.js"
I found out that not all members in the team always want to use max as a value for instances number while developing, but prefer to use some lower value.
To not change package.json I would better let them change the value inside .env file because we already use it so that the value from it would be used as the parameter to pm2.
I know I can create a wrapper js or bash script to load the variable from .env file and pass it to pm2 but it would be better to have a solution without it.
How can I achieve this?
You can create an ecosystem.config.js file and declare your environment variables under the “env:” attribute, in your case the NODE_APP_INSTANCE can be used to set the number of instances:
module.exports = {
apps : [{
name: "MyApp",
script: "./myapp.js",
env: {
NODE_ENV: "development",
NODE_APP_INSTANCE: "max"
},
env_production: {
NODE_ENV: "production",
}
}]
}
Then call pm2 start or pm2 start /path/to/ecosystem.config.js to load an ecosystem from an other folder.
A better pattern here is to remove dotenv from your code and "require" it on the command line. This makes your code nicely transportable between any environment (including cloud-based) - which is one of the main features of environment variables.
a) code up your .env file alongside your script (e.g. app.js)
b) to run your script without pm2:
node -r dotenv/config app.js
c) in pm2.config.js:
module.exports = {
apps : [{
name : 'My Application',
script : 'app.js',
node_args : '-r dotenv/config',
...
}],
}
and then
pm2 start pm2.config.js
Note: the use of dotenv/config on the command line is one of the best practices recommended by dotenv themselves