CircleCI Expected "jobRef" - testing

I am new to CircleCI, and was attempting to setup a project. The initial setup and commit built the configuration file fine, however I needed to use environment variables, so I attempted to setup a context: https://circleci.com/docs/2.0/contexts/. I made a context with my environment variable and named it 'test-context'
Here is my config file:
version: 2.1
orbs:
python: circleci/python#1.2
workflows:
sample:
jobs:
- build-and-test:
context:
- test-context
jobs:
build-and-test:
- image: cimg/python:3.6
parallelism: 4
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
...
I get the following Linter error:
ERROR IN CONFIG FILE:
[#/workflows/sample] only 1 subschema matches out of 2
1. [#/workflows/sample/jobs/0] 0 subschemas matched instead of one
| 1. [#/workflows/sample/jobs/0] expected type: String, found: Mapping
| | SCHEMA:
| | type: string
| | INPUT:
| | build-and-test: null
| | context:
| | - test-context
| 2. [#/workflows/sample/jobs/0/context] expected type: Mapping, found: Sequence
| | SCHEMA:
| | type: object
| | INPUT:
| | - test-context
and - test-context is underlined with the error: Incorrect type. Expected "jobRef"
How can I use contexts to properly integrate environment variables with my project?

#figbar, the way you are writing it on the workflow has syntax issues.
you should correct it as following.
orbs:
python: circleci/python#1.2
workflows:
sample:
jobs:
- build-and-test:
context:
- test-context
jobs:
build-and-test:
docker:
- image: cimg/python:3.6
parallelism: 4
steps:
- checkout
- python/install-packages:
- run:
...
You can get further information regarding the context on this documentation. CircleCI Context

Related

failed features: failed to get reply for: [id: 6, method: Page.navigate, params: {url=https://github.com/login}]

I am trying to setup karate for UI automation on Windows Laptop. I tried to run the sample code on the zip release 0.9.5 this is what I get.
failed features:
src.demo.web.google: google.feature:10 - failed to get reply for: [id: 6, method: Page.navigate, params: {url=https://github.com/login}]
the full stack trace is
feature: src/demo/web/google.feature:7
report: target\surefire-reports\src.demo.web.google.json
scenarios: 1 | passed: 0 | failed: 1
| time: 19.1133
---------------------------------------------------------
Karate version: 0.9.5
======================================================
elapsed: 20.17 | threads: 1 | thread time: 19.11
features: 1 | ignored: 0 | efficiency: 0.95
scenarios: 1 | passed: 0 | failed: 1
======================================================
failed features:
src.demo.web.google: google.feature:10 - failed to get reply for: [id: 6, method: Page.navigate, params: {url=https://github.com/login}]
18:43:56.084 [chrome_1595954616565] WARN com.intuit.karate.shell.Command - exit code was non-zero: 1 - [C:\Program Files (x86)\Google\Chrome\Application\chrome.exe, --remote-debugging-port=9222, --no-first-run, --user-data-dir=C:\Users\Paul\Downloads\karate-0.9.5\target\chrome_1595954616565, --disable-popup-blocking]
com.intuit.karate.exception.KarateException: there are test failures !
at ...(.)
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command java -cp karate.jar com.intuit.karate.Main "c:\Users\Downloads\karate-0.9.5\src\demo\web\google.feature:7"" terminated with exit code: 1.
Please how do I over come this.
Thanks
Nearly impossible to troubleshoot given this level of information. So I suggest you follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Else here are my guesses:
maybe Chrome is not installed in the "usual" place, read the docs: https://github.com/intuit/karate/tree/master/karate-core#configure-driver
maybe your laptop has some extra security settings, so ports are blocked, try to work with some tech support. try running cmd.exe as an "Administrator"
try switching the browser / driver, again, read the docs: https://github.com/intuit/karate/tree/master/karate-core#configure-driver
don't use PowerShell - use cmd instead. see these docs also: https://github.com/intuit/karate/wiki/Karate-Robot-Windows-Install-Guide#install-visual-studio-code
That's all I can offer, the rest is up to you (or other stack overflow users) all the best.

Errors after installing '#babel/preset-env'

when I was trying to start my npm project I got the following error:
/home/projects/reactive-weather/reactive-weather/app/node_modules/expo/src/Location.js:
Cannot find module '#babel/preset-env' from '/home/projects/reactive-weather/reactive-weather/app'
Surely I need to install this module but after I did, I'm getting this error:
Error: /home/projects/reactive-weather/reactive-weather/app/node_modules/expo/src/Location.js: Unexpected token, expected ";" (9:5)
7 | const LocationEventEmitter = new NativeEventEmitter(NativeModules.ExponentLocation);
8 |
> 9 | type ProviderStatus = {
| ^
10 | locationServicesEnabled: boolean,
11 | gpsAvailable: ?boolean,
12 | networkAvailable: ?boolean,
10:43:44 AM: Failed building JavaScript bundle
Everything was perfectly fine, the last thing I've done before this happened was using git commands like: git stash also I had to perform npm audit fix but I don't think any libs were vulnerable.

Titanium SDK 5.2.2.GA won't find iOS devices

I have an app that worked fine last year on the earlier versions of sdk but now Titanium SDK 5.2.2.GA won't find iOS devices. I tried cleaning everything about appcelerator and reinstall but no luck. I also tried installing node-ios-device as a global package and in the titanium sdk 5.2.2 folder. What else can I do?
I get the following error:
2016-05-11T09:34:54.590Z | DEBUG | [PLUGIN-LOAD] 0ms /Users/adi/.appcelerator/install/5.2.2/package/appc.js
(node:2212) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
2016-05-11T09:34:54.651Z | DEBUG | [PLUGIN-LOAD] 61ms /Users/adi/.appcelerator/install/5.2.2/package/node_modules/appc-cli-titanium/appc.js
2016-05-11T09:34:54.651Z | DEBUG | run plugin: /Users/adi/.appcelerator/install/5.2.2/package/node_modules/appc-cli-titanium
2016-05-11T09:34:54.652Z | DEBUG | [PLUGIN-LOAD] 0ms /Users/adi/.appcelerator/install/5.2.2/package/node_modules/arrow/appc.js
2016-05-11T09:34:54.654Z | DEBUG | run plugin: /Users/adi/.appcelerator/install/5.2.2/package/node_modules/arrow
2016-05-11T09:34:54.656Z | TRACE | plugin "arrow" failed its "when" function check, skipping...
2016-05-11T09:34:54.657Z | TRACE | loading plugin "titanium" for command "run" CLI options via function
2016-05-11T09:34:54.658Z | TRACE | loading plugin "titanium" for command "run" CLI options via array
2016-05-11T09:34:54.660Z | TRACE | executing command "run" with the following plugins:
["titanium"]
2016-05-11T09:34:54.661Z | TRACE | Attempting to load session info from config file
2016-05-11T09:34:54.662Z | TRACE | check if session is invalidated
2016-05-11T09:34:55.350Z | TRACE | session expiry 1463560847951 false
2016-05-11T09:34:55.351Z | TRACE | session already loaded in opts.session
2016-05-11T09:34:55.352Z | DEBUG | Titanium Downloads Last Checked: 1462957150130
2016-05-11T09:34:55.480Z | TRACE | No project alloy hook; skipping update to 1.0.0
2016-05-11T09:34:56.100Z | ERROR | An uncaught exception was thrown!
Cannot read property 'devices' of undefined
2016-05-11T09:34:56.101Z | ERROR | Cannot read property 'devices' of undefined
2016-05-11T09:34:56.101Z | TRACE | TypeError: Cannot read property 'devices' of undefined
at iOSBuilder.<anonymous> (/Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/iphone/cli/commands/_build.js:298:11)
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/ioslib/index.js:115:12
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/async/lib/async.js:721:13
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/async/lib/async.js:52:16
at done (/Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/async/lib/async.js:241:17)
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/async/lib/async.js:44:16
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/async/lib/async.js:718:17
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/async/lib/async.js:167:37
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/ioslib/index.js:85:6
at /Users/adi/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/node_modules/ioslib/lib/device.js:51:12
For anybody who encounters this, the problem is the NodeJS version, I had v6.2.0 and downgraded to v4.4.4. All works now.
Thanks Adi, I had the exact same issue v6.2.0 of Node and downgraded to v4.4.x and all works for me as well.

RabbitMQ 2.7.1 doesn't start with configuration file; Reason: function_clause

I try to use rabbit on ubuntu 12.04. After installation rabbitmq-server works fine. Than I stop it and add my configuration file.
root#rabbit1:~# tail /etc/rabbitmq/rabbitmq-env.conf
RABBITMQ_CONFIG_FILE=/etc/rabbitmq/myrabbitmq
root#rabbit1:~# tail /etc/rabbitmq/myrabbitmq.config
[{rabbit,
[{cluster_nodes, {['rabbit#rabbit1', 'rabbit#rabbit2'], disc}}]}].
With this files rabbitmq-server says on start:
root#rabbit1:~# rabbitmq-server
Activating RabbitMQ plugins ...
0 plugins activated:
+---+ +---+
| | | |
| | | |
| | | |
| +---+ +-------+
| |
| RabbitMQ +---+ |
| | | |
| v2.7.1 +---+ |
| |
+-------------------+
AMQP 0-9-1 / 0-9 / 0-8
Copyright (C) 2007-2011 VMware, Inc.
Licensed under the MPL. See http://www.rabbitmq.com/
node : rabbit#rabbit1
app descriptor : /usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/sbin/../ebin/rabbit.app
home dir : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/myrabbitmq.config
cookie hash : 31CaH3BCSDNL1hDIFQzH2Q==
log : /var/log/rabbitmq/rabbit#rabbit1.log
sasl log : /var/log/rabbitmq/rabbit#rabbit1-sasl.log
database dir : /var/lib/rabbitmq/mnesia/rabbit#rabbit1
erlang version : 5.8.5
-- rabbit boot start
starting file handle cache server ...done
starting worker pool ...done
starting database ...BOOT ERROR: FAILED
Reason: function_clause
Stacktrace: [{lists,usort,[{[rabbit#rabbit1,rabbit#rabbit2],disc}]},
{rabbit_mnesia,init_db,3},
{rabbit_mnesia,init,0},
{rabbit,'-run_boot_step/1-lc$^1/1-1-',1},
{rabbit,run_boot_step,1},
{rabbit,'-start/2-lc$^0/1-0-',1},
{rabbit,start,2},
{application_master,start_it_old,4}]
Erlang has closed
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{bad_return,{{rabbit,start,[normal,[]]},{'EXIT',{rabbit,failure_during_boot}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{bad_return,{{rabbit,start,[normal,[]]},{'EXIT',{rabbit,failure_during_boot}}}}})
Have any suggestion what's wrong with my rabbit?
Configuration file should be like this:
root#rabbit1:~# cat /etc/rabbitmq/myrabbitmq.config
[{rabbit,
[{cluster_nodes, ['rabbit#rabbit1', 'rabbit#rabbit2'] }]}].
It seems, that disc or ram node configures in different way than in documentation to latest version of rabbit. In this configuration two disc nodes will be created. If somebody wants ram node this node should be ommitted in configuration of this node (not in other config files).

Maven command to list lifecycle phases along with bound goals?

I'm just learning Maven, and so this might be obvious, but I can't find an easy way to list the goals associated for each maven lifecycle phase for a given project.
I saw that the Maven default life cycle phases and corresponding default goals are documented here. My understanding so far is that each pom.xml can bind additional goals to each lifecycle phase.
So, is there a mvn command to determine the goals that will be run for each lifecycle phase for a given project? If not, I guess I just have to look through the pom.xml for each new maven project to figure this out?
The buildplan-maven-plugin is an excellent tool for showing how goals are bound to phases.
Below are examples of commands you can run. The commands will automatically download and install the plugin if it hasn't already been installed.
List goals by the order they will execute
> mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list
PLUGIN | PHASE | ID | GOAL
--------------------------------------------------------------------------------------------
maven-enforcer-plugin | validate | default | enforce
maven-dependency-plugin | process-sources | default | copy-dependencies
maven-resources-plugin | process-resources | default-resources | resources
maven-compiler-plugin | compile | default-compile | compile
maven-resources-plugin | process-test-resources | default-testResources | testResources
maven-compiler-plugin | test-compile | default-testCompile | testCompile
maven-surefire-plugin | test | default-test | test
maven-jar-plugin | package | default-jar | jar
maven-assembly-plugin | package | make-assembly | single
maven-install-plugin | install | default-install | install
maven-deploy-plugin | deploy | default-deploy | deploy
Group goals by phase
> mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list-phase
validate -----------------------------------------------------------------
+ maven-enforcer-plugin | default | enforce
process-sources ----------------------------------------------------------
+ maven-dependency-plugin | default | copy-dependencies
process-resources --------------------------------------------------------
+ maven-resources-plugin | default-resources | resources
compile ------------------------------------------------------------------
+ maven-compiler-plugin | default-compile | compile
process-test-resources ---------------------------------------------------
+ maven-resources-plugin | default-testResources | testResources
test-compile -------------------------------------------------------------
+ maven-compiler-plugin | default-testCompile | testCompile
test ---------------------------------------------------------------------
+ maven-surefire-plugin | default-test | test
package ------------------------------------------------------------------
+ maven-jar-plugin | default-jar | jar
+ maven-assembly-plugin | make-assembly | single
install ------------------------------------------------------------------
+ maven-install-plugin | default-install | install
deploy -------------------------------------------------------------------
+ maven-deploy-plugin | default-deploy | deploy
Group goals by plugin
> mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list-plugin
maven-enforcer-plugin ---------------------------------------------------
+ validate | default | enforce
maven-dependency-plugin -------------------------------------------------
+ process-sources | default | copy-dependencies
maven-resources-plugin --------------------------------------------------
+ process-resources | default-resources | resources
+ process-test-resources | default-testResources | testResources
maven-compiler-plugin ---------------------------------------------------
+ compile | default-compile | compile
+ test-compile | default-testCompile | testCompile
maven-surefire-plugin ---------------------------------------------------
+ test | default-test | test
maven-jar-plugin --------------------------------------------------------
+ package | default-jar | jar
maven-assembly-plugin ---------------------------------------------------
+ package | make-assembly | single
maven-install-plugin ----------------------------------------------------
+ install | default-install | install
maven-deploy-plugin -----------------------------------------------------
+ deploy | default-deploy | deploy
Notes
By default, the goals search for tasks that would run if the user invoked mvn deploy. Phases such as clean won't be included. To include multiple phases in the search, use the buildplan.tasks property:
> mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list -Dbuildplan.tasks=clean,deploy
mvn help:describe -Dcmd=compile (or any other valid phase)
One tool that helps is mvn help:effective-pom It will print the POM with all variables and all parent POMs expanded. This helps to understand what Maven sees. From that, it's pretty simple to find all the additional goals (which usually aren't that many).
The bigger problem is the implicit goals (i.e. when a plugin hooks itself to some phases of the lifecycle automatically). There is no easy way to see these without actually running Maven. This should become better in Maven 3. Until then, run Maven with -X which will print a whole lot of debug output plus the current phase and which plugins are executed.
If not with Maven but using m2e you can do it using the code block that you can use in a Eclipse plugin:
final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
final IMavenProjectFacade facade = projectRegistry.getProject(project);
projectRegistry.execute(facade, new ICallable<Void>() {
public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
MavenProject mavenProject = facade.getMavenProject(monitor);
List<MojoExecution> mojoExecutions = ((MavenProjectFacade) facade).getMojoExecutions(monitor);
LifecycleMappingResult mappingResult = LifecycleMappingFactory.calculateLifecycleMapping(
mavenProject, mojoExecutions, facade.getResolverConfiguration().getLifecycleMappingId(),
monitor);
Map<MojoExecutionKey, List<IPluginExecutionMetadata>> mojoExecutionMapping = mappingResult
.getMojoExecutionMapping();
Map<String, List<MojoExecutionKey>> phases = new LinkedHashMap<String, List<MojoExecutionKey>>();
for (MojoExecutionKey execution : mojoExecutionMapping.keySet()) {
List<MojoExecutionKey> executions = phases.get(execution.getLifecyclePhase());
if (executions == null) {
executions = new ArrayList<MojoExecutionKey>();
phases.put(execution.getLifecyclePhase(), executions);
}
executions.add(execution);
}
Look at full source.
Already implemented in:
http://marketplace.eclipse.org/content/phases-and-goals
It makes use of m2e's ability to compute the association of goals with phases. I am also trying to solve it at maven level.
These goals are built in to Maven now so you can just do ./mvnw buildplan:list
The plugin "product" page is now here: https://www.mojohaus.org/buildplan-maven-plugin/.
I put Chad's answer into a script (so I don't have to remember the plugin name which is really long). Put it in your ~/bin/ folder so you can use it anywhere.
#!/usr/bin/env bash
# Created based on https://stackoverflow.com/a/35610377/529256
debug=false
goal='list-phase'
build_plan='clean,deploy'
working_directories=""
for (( i=1; i<=$#; i++ )) do
case ${!i} in
-h|--help)
programName=$( basename ${0} )
echo "Lists the goals of mvn project(s) by phase in a table";
echo
echo "Usage:";
echo " ${programName} -d|--debug -g|--goal goal -b|--build_plan build_plan [*directory]";
echo
echo " --goal The goal for the buildplan-maven-plugin (default: $goal)"
echo " (possible values: list, list-plugin, list-phase)"
echo
echo " --build_plan The value of the buildplan.tasks parameter (default: $build_plan)"
echo " (examples: 'clean,install', 'deploy', 'install', etc...) "
echo
echo " [*directory] The directories (with pom.xml files) to run the command in"
exit 0;
;;
-d|--debug)
debug=true;
echo "debug = ${debug}";
;;
-b|--build_plan)
((i++))
build_plan="${!i}"
;;
-g|--goal)
((i++))
goal="${!i}"
;;
*)
working_directory="${!i}";
if [ ! -e "${working_directory}" ]; then
echo "'${working_directory}' doesn't exist";
exit 1;
fi;
if [ -z "${working_directories}" ]; then
working_directories="$working_directory"
else
working_directories="$working_directories ${!i}"
fi;
;;
esac;
done;
if [ -z "${working_directories}" ]; then
working_directories="$PWD"
fi
if [ ${debug} = true ]; then
echo "working_directories=$working_directories"
echo "goal=$goal"
echo "build_plan=$build_plan"
fi
for workingDirectory in ${working_directories}; do
pushd ${workingDirectory} > /dev/null
echo "cd $workingDirectory"
echo "mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:${goal} -Dbuildplan.tasks=${build_plan}"
mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:${goal} -Dbuildplan.tasks=${build_plan}
popd > /dev/null
done;