Gradle Artifactory and space in name - space

I am having an artifact published with space in Artifactory. We have the POM published as well. Reference getting is:
compile group: 'com.local', name: "Artifact Name", version: '1.3'
If I get this, I got error below. If I put the Artifact%20Name then I got problem with
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParseException: inconsistent module metadata found. Descriptor: com.local:Artifact Name:1.3 Errors: bad module name: expected='Artifact%20Name' found='Artifact Name'
Is there a way that gradle can just replace the space with %20 to prevent the illegal character?
... 209 more
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 81: http://artifactory:8081/artifactory/repos/com/local/Artifact Name/1.3/Artifact Name-
1.3.pom
at java.net.URI.create(URI.java:859)
at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:66)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:70)
at org.gradle.api.internal.externalresource.transport.http.HttpResourceAccessor.getResource(HttpResourceAccessor.java:46)

Related

error while using maven for password encryption

I am trying to encrypt the password using maven by following this link- Generate settings-security.xml file for maven password encryption. But, in the step after creating master password and creating the file settings-security.xml, but while trying to run the command- mvn --encrypt-password '!12345', I am getting the following error:
[ERROR] Error executing Maven.
[ERROR] org.codehaus.plexus.util.xml.pull.XmlPullParserException: start tag unexpected character { (position: TEXT seen <settingsSecurity>\n<master{... #2:9)
[ERROR] Caused by: start tag unexpected character { (position: TEXT seen <settingsSecurity>\n<master{... #2:9)
abhinashkumarjha#C02DP5F7MD6R ~ % mvn --encrypt-password '!Abhi#090342'
[ERROR] Error executing Maven.
[ERROR] org.codehaus.plexus.util.xml.pull.XmlPullParserException: start tag unexpected character { (position: START_TAG seen <settingsSecurity><master{... #1:26)
[ERROR] Caused by: start tag unexpected character { (position: START_TAG seen <settingsSecurity><master{... #1:26)
My settings-security.xml looks like this:
<settingsSecurity>
<master{42xI34HcwGIH/t9Bhr5P4ctsVIjOtvPO81b2eb9uYWY=}</master>
</settingsSecurity>
Thanks in Advance!!

swagger-codegen is not correctly generating common parameters for any language

According to the swagger documentation, I should be able to have common parameters that are shared by all operations. The problem is that when running codegen locally, the generated code does not have any of the common path parameters. The below yaml produces code for any language (I've tried two).
What is very confusing is that if I use this exact yaml in https://editor.swagger.io/, the generated code does have the path parameters. I ran this for two different languages, typescript:
And C#:
Left is the code generated in editor.swagger.io and right is my generated code by running codegen locally.
In both cases, the .swagger-codegen\VERSION the file is 3.0.20 which is the one I'm using but the code generated by https://editor.swagger.io/ does have the parameter paths.
This simple yaml file reproduces the issue:
openapi: 3.0.2
info:
title: title
version: 1.0.0
paths:
'/instances/{id}':
summary: Manipulate a particular instance
get:
responses:
'200':
description: Ok
content:
text/plain:
schema:
type: string
example: pong
summary: Fetches an instance
parameters:
- in: path
name: id
schema:
type: integer
required: true
components:
securitySchemes:
bearerAuth:
scheme: bearer
bearerFormat: JWT
type: http
The command line used for generation:
java ^
-classpath bin/swagger-codegen-cli.jar ^
-DdebugOperations ^
io.swagger.codegen.v3.Codegen ^
generate ^
-i enterpos-api.yaml ^
-l typescript-angular ^
-o generated-code/typescript-angular-builtin
And that generated this output: https://gist.github.com/alanboy/45ce792255e079dd0de4f70449ebf455. I feel like this might be wrong usage or something wrong with my yaml but I can't figure out what.
The problem is the Main class. I noticed that using the io.swagger.codegen.v3.Codegen class produces incorrect results :
java -classpath bin/swagger-codegen-cli.jar io.swagger.codegen.v3.Codegen <more>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
But this works:
java -jar bin/swagger-codegen-cli.jar <more>
Which led me to open MANIFEST.MF in the jar and notice the main class is actually this:
Main-Class: io.swagger.codegen.v3.cli.SwaggerCodegen
I then ran the command like this and everything worked as expected.
java -classpath bin/swagger-codegen-cli.jar io.swagger.codegen.v3.cli.SwaggerCodegen <more>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Getting an error while running jenkins job to deploy java application to tomcat server using Ansible template

I am getting the following error using ansible playbook
Ansible Playbook:
hosts: all_hosts
become: true
tasks:
name: copy jar/war onto tomcat servers
copy:
src: /opt/playbooks/wabapp/target/webapp.war
dest: /opt/apache-tomcat-8.5.54/webapps
Error in jenkins
SSH: Connecting with configuration [Ansible] ...
SSH: EXEC: STDOUT/STDERR from command [ansible-playbook /opt/playbooks/file.yml] ...
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/opt/playbooks/file.yml': line 6, column 13, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: copy jar/war onto tomcat servers
copy:
^ here
SSH: EXEC: completed after 801 ms
SSH: Disconnecting configuration [Ansible] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [4]]
Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

Hadoop/Yarn Docker-Container-Executor fails because of "Invalid docker rw mount"

I am trying to execute the simple example for the Hadoop/Yarn (Version: 2.9.1) Docker-Container-Executor:
vars="YARN_CONTAINER_RUNTIME_TYPE=docker,YARN_CONTAINER_RUNTIME_DOCKER_IMAGE=hadoop-docker"
hadoop jar hadoop-examples.jar pi -Dyarn.app.mapreduce.am.env=$vars -Dmapreduce.map.env=$vars -Dmapreduce.reduce.env=$vars 10 100
Unfortunately the job fails with the following exception:
Failing this attempt.Diagnostics: [2018-09-08 22:23:54.288]Exception from container-launch.
Container id: container_1536441225683_0004_02_000001
Exit code: 29
Exception message: Invalid docker rw mount '/tmp/hadoop-hadoop/nm-local-dir/usercache/hadoop/appcache/application_1536441225683_0004/:/tmp/hadoop-hadoop/nm-local-dir/usercache/hadoop/appcache/application_1536441225683_0004/', realpath=/tmp/hadoop-hadoop/nm-local-dir/usercache/hadoop/appcache/application_1536441225683_0004/
Error constructing docker command, docker error code=14, error message='Invalid docker read-write mount'
Anybody has an idea how to solve the Invalid docker read-write mount?
Solved by adding this directory to property docker.allowed.rw-mounts in etc/hadoop/container-executor.cfg. If you get error message for multiple directories they need to be added comma seperated.
In my case:
docker.allowed.rw-mounts=/usr/local/hadoop/,/var/hadoop/yarn/local-dir,/var/hadoop/yarn/log-dir,/tmp/hadoop-hadoop/

spring-cloud-skipper : How to delete and re-deploy a package

I want to redeploy a package but I am getting an error:
skipper:>package install --package-name sg-cloud-MbakTestworld
--package-version 0.0.1 --release-name MbakTestworld --file E:\skipper\apps\MbakTestworld-upgrade-local.yml
Result:
Release with the name [] already exists and it is not deleted. Details
of the error have been omitted. You can use the stacktrace command to
print the full stacktrace.
My yml File:
spec:
applicationProperties:
server.port: 8029
spring.profiles.active: mbakCloud
deploymentProperties:
spring.cloud.deployer.memory: 512m
I found the answer:
skipper:>release delete --release-name MbakTestworld
MbakTestworld has been deleted.
Source: https://docs.spring.io/spring-cloud-skipper/docs/current/reference/htmlsingle/

Resources