postman/newman - Updating the environmentvariables.json from github secrets - environment-variables

I have a lot of environment variables in my json file. Instead of passing them as --env-var while specifying the newman run command, is it possible to update the environment variables json file directly from github secrets? Like so:
{
"key": "API_ClientSecret",
"value": "${{secrets.API_ClientSecret}}",
"type": "default",
"enabled": true
},
{
"key": "API_Client_Id",
"value": "${{secrets.API_ClientId}}",
"type": "default",
"enabled": true
},

Related

How do I add environment variables to launch.json in VSCode for a rails

I am using ruby-debug-ide and debase for debugging in vs code in that when i start debugging by default server is started in development environment, how to debug in a different environment like test/qa? how to configure this launch.json
My launch.json file
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/bin/rails",
"args": [
"server"
],
"showDebuggerOutput": true,
"env": {
"PATH": "/Users/giri.shankar/.rvm/gems/ruby-2.6.3#codeforkout/bin:/Users/giri.shankar/.rvm/gems/ruby-2.6.3#global/bin:/Users/giri.shankar/.rvm/rubies/ruby-2.6.3/bin:/Users/giri.shankar/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"GEM_HOME": "/Users/giri.shankar/.rvm/gems/ruby-2.6.3#codeforkout",
"GEM_PATH": "/Users/giri.shankar/.rvm/gems/ruby-2.6.3#codeforkout:/Users/giri.shankar/.rvm/gems/ruby-2.6.3#global",
"RUBY_VERSION": "ruby-2.6.3"
}
}
]
}
For time being i changed the default environment to qa by adding the below line in boot.rb, so now whenever i run rails s qa environment is booted by default
ENV["RACK_ENV"] = "qa"
You just have to add -e test to the rails server command:
{
...
"args": [
"server -e test"
]
}

How to autorun webpack-dev-server when starting debugging RoR session?

Since Rails 5.1, It's possible to run rails server next to webpack-dev-server. I have configured debugger in launch.json to run rails server. When I start rails server throught vscode, I want it to automatically run ./bin/webpack-dev-server on background for autocompile javascript changes as another process, but I can't figure out how to achieve this.
I have created task in tasks.json to run webpacker but I can't figure out how to combine it with launch.json.
Here is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"preLaunchTask": "webpack-dev-server",
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/bin/rails",
"args": [
"server"
]
}
]
}
And here is tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "webpack-dev-server",
"type": "shell",
"command": "${workspaceRoot}/webpack-dev-server",
"isBackground": true,
}
]
}
When I run debugging and task separately, It's working as expected, but run then automatically when starting debugging not working.
Things I've tried:
run webpack-dev-server with "preLaunchTask" - problem with this is that "preLaunchTask" waits until webpack-dev-server stop running and after that runs debugging. I need them to run simultaneously next to each other.
Specify webpack-dev-server as another launch configuration and combine these two launches through compond in launch.json - this isn't working, because vscode needs to specify type of launch and shell isn't supported
run task with & at the end to suppress waiting for process finish - not working
If anybody solved this or know how to achieve running both processes simultaneously through one click, It would be helpful to share this knowledge.
Thank you.
So I found the solution thanks to https://stackoverflow.com/a/54017304/3442759.
In tasks.json there needs to be specified problemMatcher even when it's not used. Without problemMatcher specified, task will not run in the background even when isBackground is set to true.
I've created gist with setup steps. https://gist.github.com/tomkra/b1d67a7ae96af34cba78935f15b755b6
So final configuration is:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/bin/rails",
"args": [
"server"
],
"preLaunchTask": "webpack-dev-server"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "webpack-dev-server",
"type": "shell",
"isBackground": true,
"command": "./bin/webpack-dev-server",
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": ".",
}
}
]
}
]
}

using OpenCV in VS code

I'm writing a simple program using VS Code, Mingw and OpenCv Lib. I downloaded a prebuild OpenCV package from here and I followed the instruction in this page for building the code. I can build the program successfully with no error but there is a problem. when I call OpenCV function(like cv::imread) an segmentation fault occurs. It will be appreciated for any kind of help.
task.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\mingw\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"${workspaceFolder}/utils.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-IC:\\OpenCV\\include",
"-LC:\\OpenCV\\x64\\mingw\\bin",
"-llibopencv_calib3d341",
"-llibopencv_core341",
"-llibopencv_dnn341",
"-llibopencv_features2d341",
"-llibopencv_flann341",
"-llibopencv_highgui341",
"-llibopencv_imgcodecs341",
"-llibopencv_imgproc341",
"-llibopencv_ml341",
"-llibopencv_objdetect341",
"-llibopencv_photo341",
"-llibopencv_shape341",
"-llibopencv_stitching341",
"-llibopencv_superres341",
"-llibopencv_video341",
"-llibopencv_videoio341",
"-llibopencv_videostab341"
],
"options": {
"cwd": "C:\\mingw\\mingw64\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "shell",
"label": "g++.exe build active file",
"command": "C:\\mingw\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\mingw\\mingw64\\bin"
}
}
]
}
c_cpp_properties.json
{
"configurations": [{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/OpenCV/include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"compilerPath": "C:\\mingw\\mingw64\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}],
"version": 4
}
Is this on Windows? If so I don't think the issue is with your VS Code files if you're only facing problems after build. You may want to check your opencv or mingw-w64 installation, did you build and install with cmake? For Mingw64, was your install configuration correct for your machine?
Assuming of course that everything has also been added to your Windows path environment variable, I tested your cpp_properties.json and tasks.json setup with my own opencv windows vs code environment. The only things I did differently were to get rid of include errors, such as:
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"absolute"
]
},
"group": {
"kind":"build",
"isDefault": true
}
To my tasks.json problemMatcher statement and group statement so that the system could properly find the opencv library. I also don't know what the "${workspaceFolder}/utils.cpp" line is doing in tasks.json, but regardless, if you're able to build fine it would seem to me there's more likely an underlying problem with either mingw or opencv.

Default packer builder without using -only option

I have multiple builders section in my packer template, by default this builds both builder on the cloud provider at the same time.
However, if I want to build only the "amazon-ebs" type on the cloud, and use "docker" type locally I can get this with done with packer build -only=rails <path/to/template.yaml>.
Is there a way I can set the default builder to "rails" in the template without using the -only=rails from the packer CLI option.
"builders": [
{
"name": "rails"
"type": "amazon-ebs",
"region": "us-west-2",
"source_ami": "{{user `rails_web_ami`}}",
"instance_type": "m3.medium",
"ami_name": "deploy-rails-web-{{user `sha`}}",
"availability_zone": "us-west-2c",
"ssh_username": "centos",
"ssh_pty" : "true"
},
{
"name": "docker-local",
"type": "docker",
"pull": "true",
"image": "askb/centos7:latest",
"run_command": [ "-d", "-t", "-i", "{{.Image}}", "/bin/bash"],
"changes": [
"WORKDIR /tmp",
"EXPOSE 8080",
"USER jenkins",
"LABEL buildtime {{isotime \"20060102-150405.000\"}}"
],
"commit": true
}
],
"provisioners": ...
No, you have to use -only there is nothing like "default builder".

SCM-manager CLI to set branch write protection

I have downloaded SCM-manager-CLI
I need to set the branch write protection for GIT repository in SCM-manager through CLI
I have set the same through web-app
I need to do that through CLI as a part of Automation
How to do that?
Hi the cli has currently no support for properties, but you can use the rest api to set the properties:
curl -u scmadmin:scmadmin -v http://localhost:8080/scm/api/rest/repositories -XPOST -H 'Content-Type: application/json' -d '{
"name": "newrepository",
"description": "repository with branch protection",
"type": "git",
"properties": [
{ "key": "branchwp.enabled", "value": true },
{ "key": "branchwp.permissions", "value": "master,userone;develop,#devgroup;" }
],
"permissions": [
{ "name": "userone", "type": "WRITE", "groupPermission": false },
{ "name": "devgroup", "type": "WRITE", "groupPermission": true }
]
}'
The example above creates a new repository with enabled branch protection.

Resources