Publishing an .apk into IBM Application Center from Application Center command-line tools - ibm-mobilefirst

I'm trying to publish an .apk into my Application Center through console. I've followed this note but it doesn't work in my environment:
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/moving-production/distributing-mobile-applications-with-application-center/#cmdLineTools
If I type :
./acdeploytool.sh /home/miguel/Downloads/HelloWorldMyHelloAndroid.apk
I get this error message:
FWLAC0803E: Unable to connect:
Connection refused
Perhaps the server or context is wrongly specified.
File:/home/myUser/Downloads/HelloWorldMyHelloAndroid.apk
And if I try another way using this java command:
java com.ibm.appcenter.Upload -f http://localhost:9080 -c applicationcenter -u demo -p demo /home/myUser/Downloads/HelloWorldMyHelloAndroid.apk
I get this one:
Error: Could not find or load main class com.ibm.appcenter.Upload
I don't get any errors when I do this 'publish' operation directly in Application Center or through MobileFirst Studio.

Miguel, whether you use the script or the Java command, you need to specify the arguments to use. Please try the following:
./acdeploytool.sh -s http://localhost:9080 -c applicationcenter -u demo -p demo /home/miguel/Downloads/HelloWorldMyHelloAndroid.apk
I tried a similar command in my environment and was able to successfully deploy the apk to Application Center. If the command still does not work, make sure that the host/port that you are using are correct, and that the username and password are valid.
For the Java command that you executed, I see a few problems. First, the -cp argument needs to be specified in order to add the applicationcenterdeploytool.jar and json4j.jar files to the classpath. Next, the command shows "-f", but it should be "-s" to specify the server. Lastly, the path that was specified for the .apk is different than what you specified in the first command: myUser vs. miguel. So make sure that the correct path is used. If there are any further questions, let me know. Thanks.

Related

NIFI - Unable to Set Username and Password Windows

I have Apache NiFi 1.16.3 downloaded and set up, but when I try to run the command for setting the Single User userid and password (nifi.sh set-single-user-credentials) using Git Bash in Windows I receive the following error:
Error: Could not find or load main class org.apache.nifi.authentication.single.user.command.SetSingleUserCredentials
I have also tried running the workaround command by invoking the java jar explicitly with no success.
Does the capability to change the username and password not work on Windows?
Check https://issues.apache.org/jira/browse/NIFI-9500
The following command can be used to call the Java class directly as a workaround:
java -cp 'lib/bootstrap/*' -Dnifi.properties.file.path=conf/nifi.properties org.apache.nifi.authentication.single.user.command.SetSingleUserCredentials username passwordpassword

My UIautomator is not starting in mac. I have done everything possible

I am learning appium and I have set up everything that is required. I have setup paths, installed android studio, run appium and created a virtual android device too. But when i am writing uiautomatorviewer its giving me an error
mac#Macs-MacBook-Pro ~ % uiautomatorviewer
-Djava.ext.dirs=/Users/mac/Library/Android/sdk/tools/lib/x86_64:/Users/mac/Library/Android/sdk/tools/lib is not supported. Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
mac#Macs-MacBook-Pro ~ %
Can anyone help me please
A. I encountered this issue once, sometime env var doesn't load and it throws error, open and load bash profile and run that command.
open ~/.bash_profile
source ~/.bash_profile
uiautomatorviewer
B. if appium server is running, try to close it and run the command.
Try the following command:
sudo ./uiautomatorviewer

SSH connection command to embedded OS QNX Neutrino via paramiko [duplicate]

I am trying to run sesu command in Unix server from Python with the help of Paramiko exec_command. However when I am running this command exec_command('sesu test'), I am getting
sh: sesu: not found
When I am running simple ls command it giving me desired output. Only with sesu command it is not working fine.
This is how my code looks like:
import paramiko
host = host
username = username
password = password
port = port
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip,port,username,password)
stdin,stdout,stderr=ssh.exec_command('sesu test')
stdin.write('Password')
stdin.flush()
outlines=stdout.readlines()
resp=''.join(outlines)
print(resp)
The SSHClient.exec_command by default does not run shell in "login" mode and does not allocate a pseudo terminal for the session. As a consequence a different set of startup scripts is (might be) sourced, than in your regular interactive SSH session (particularly for non-interactive sessions, .bash_profile is not sourced). And/or different branches in the scripts are taken, based on an absence/presence of TERM environment variable.
Possible solutions (in preference order):
Fix the command not to rely on a specific environment. Use a full path to sesu in the command. E.g.:
/bin/sesu test
If you do not know the full path, on common *nix systems, you can use which sesu command in your interactive SSH session.
Fix your startup scripts to set the PATH the same for both interactive and non-interactive sessions.
Try running the script explicitly via login shell (use --login switch with common *nix shells):
bash --login -c "sesu test"
If the command itself relies on a specific environment setup and you cannot fix the startup scripts, you can change the environment in the command itself. Syntax for that depends on the remote system and/or the shell. In common *nix systems, this works:
PATH="$PATH;/path/to/sesu" && sesu test
Another (not recommended) approach is to force the pseudo terminal allocation for the "exec" channel using the get_pty parameter:
stdin,stdout,stderr = ssh.exec_command('sesu test', get_pty=True)
Using the pseudo terminal to automate a command execution can bring you nasty side effects. See for example Is there a simple way to get rid of junk values that come when you SSH using Python's Paramiko library and fetch output from CLI of a remote machine?
You may have a similar problem with LD_LIBRARY_PATH and locating shared objects.
See also:
Environment variable differences when using Paramiko
Certain Unix commands fail with "... not found", when executed through Java using JSch

Jenkins: Publish over SSH after failed build

I am trying to use the Publish Over SSH plugin to publish many kinds of build artifact to an external server. Examples of build artifacts are compiled builds, XML output from testing, and JSON output from linting.
If testing or linting results in errors, the build will fail or be marked unstable. In the case of a failed build, the Publish Over SSH plugin will not copy the build artifacts, writing to the console:
SSH: Current build result is [FAILURE], not going to run.
I see no reason why I wouldn't want to publish this information if it exists, and I would like to continue to report errors as build failures. So, is there any way to force Jenkins to publish build artifacts even if the job is marked as a failure?
I thought I could use the Flexible Publish to force this, by wrapping the Publish Over SSH in an "always" condition, but this gave the same output as before on a build failure.
I can think of a couple of work-arounds:
a) store the build status in an environment variable; force the status to SUCCESS; perform the publish step; recover the build status from the environment variable using java jenkins-cli.jar set-build-status $STORED_STATUS
OR
b) Write a bash script to perform the publishing step manually using SSH, cutting out the Publish Over SSH plugin altogether
Before I push forward with either of these solutions (neither of which I like), is there any piece of configuration that I'm missing?
The solution I ended up using was to use rsync/ssh to copy the files manually using a post build script. I configured this in my Jenkins Job Builder YAML like so:
- publisher:
name: publish-to-archive
publishers:
- post-tasks:
- matches:
- log-text: ".*"
script: |
ssh -i ${{HOME}}/.ssh/id_rsa jenkins#archiver "mkdir -p {archive_path}"
rsync -Pravdtze "ssh -i ${{HOME}}/.ssh/id_rsa" {source_path} jenkins#archiver:{archive_path}
Quoting old hooky on jenkinsci-users:
How can I force Publish Over SSH to work even if the build has been marked
a failure?
Use "Send files or execute commands over SSH after the build runs" in
configuration section "Build environment"
Job configuration / Build Environment / Send files or execute commands over SSH after the build runs
instead of using a post-build or build-step.

Jenkins CLI exception: missing Job/ExtendedRead permission

I have a Jenkins user that I want to give rights to run the remote CLI towards the Jenkins instance. The first command is to fetch the config.xml:
java -jar jenkins-cli.jar -s http://jenkins:8080/hudson get-job thejob
However when he invokes the command, it fails with:
Caught: java.lang.RuntimeException: \
hudson.security.AccessDeniedException2: \
USER is missing the Job/ExtendedRead permission \
at hudson.security.ACL.checkPermission(ACL.java:54)
I have given the rights to execute scripts, read/create/configure jobs and more in our matrix-based security grid. There is another user who has EXACTLY the same permissions in the grid, but for this other user, everything works fine.
I don't have any of the plugins 'Extended Read permission' or 'Read-only configurations' installed.
I cannot see why it fails for this new user. Suggestions anyone?
Differences in the 2 users config.xml file:
<com.cloudbees.plugins.credentials.UserCredentialsProvider_-UserCredentialsProperty plugin="credentials#1.4">
<credentials/>
vs:
<com.cloudbees.plugins.credentials.UserCredentialsProvider_-UserCredentialsProperty plugin="credentials#1.8.3">
<domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash"/>
And a final one:
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>some values...</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
I don't know if you are facing the same problem I had, but take a look here:
Jenkins CLI: using Anonymous permissions instead of the user defined ones
It looks like you have upgraded the credentials plugin but somehow the first user didn't get its record updated.
If you can I would suggest trying to update to the latest (1.9.1 for me). You could also edit the user record manually and force the real plugin version number in there (then restart Jenkins) and see if it processes this user more accurately.