Download the artifact from bamboo using wget - bamboo

I am using wget to download bamboo artifact using the below command,
wget --http-user='userName' --http-password='*****' 'http://localhost/rest/api/latest/plan/AP-BAF/artifact?os_authType=basic' --no-check-certificate
where AP-BAF is the build plan and that plan has two stages and each stage produce artifacts.I want to download these two artifacts.
When I enter this command in command prompt,it shows the below output,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><artifacts expand="artifa
cts"><link href="http://localhost/rest/api/latest/plan/AP-BAF
/artifact" rel="self"/><artifacts start-index="0" max-result="0" size="0"/></art
ifacts>
When i browse through bamboo and I can see the artifacts produced by the build.
Please help me as this is the high priority.

Try using os_username and os_password in the parameters. See https://jira.atlassian.com/browse/BAM-7259 for details.
wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate https://bamboo/userlogin\!default.action\?os_destination=%2Fstart.action\&os_username=myusername\&os_password=*****\&os_cookie=true

Related

Tf Serving - Docker from source or build from git?

Struggling to understand the workflow here for tf serving.
Official docs say to “docker pull tensorflow/serving”. But they also say to “git clone https://github.com/tensorflow/serving.git”
Which one should I use? I assume the git version is so I can build my own custom serving image?
When I pull the official image from docker and run the container, why can’t I access the root? Is it because I haven’t “built it” properly yet?
If you have added some custom code, then clone first and then build image.
If you want to deploy image directly, pull image and run.
BTW, what do you mean by "access the root"? AFAIC, root is the default user in a container.
I think that is a good observation.
Only place where I feel cloning Git hub repository using "https://github.com/tensorflow/serving.git" is required if you want to run the examples like 'half_plus_two', 'half_plus_three' or if you want to run the Examples mentioned in the link,
https://github.com/tensorflow/serving/tree/master/tensorflow_serving/example.
Except that, as far as I know, pulling the Docker Image should do everything needed.
Even building the Custom Docker Image using our Custom Model doesn't need us to clone the Git hub repo.
Code for building Custom Docker Image is shown below:
sudo docker run -d --name sb tensorflow/serving
sudo docker cp /usr/local/google/home/abc/Jupyter_Notebooks/Premade_Estimator_Export sb:/models/Premade_Estimator_Export
sudo docker commit --change "ENV MODEL_NAME Premade_Estimator_Export" sb iris_container
sudo docker kill sb
sudo docker pull tensorflow/serving
sudo docker run -p 8501:8501 --mount type=bind,source=/usr/local/google/home/abc/Jupyter_Notebooks/TF_Serving/Premade_Estimator_Export,target=/models/Premade_Estimator_Export -e MODEL_NAME=Premade_Estimator_Export -t tensorflow/serving &
saved_model_cli show --dir /usr/local/google/home/abc/Jupyter_Notebooks/Premade_Estimator_Export/1556272508 --all
curl http://localhost:8501/v1/models/Premade_Estimator_Export #To get the status of the model
Regarding access to Root, if I understand it correctly, you don't want to run the docker commands using Sudo at the start for each command. Please follow the below mentioned command to get access to Root.
i. Add docker group if it does not already exist
ii. Add the connected user $USER to the docker group. Below are the commands to be run in the Terminal:
sudo groupadd docker
sudo usermod -aG docker $USER
iii. Reboot your PC and you should be able to execute Docker commands without sudo.

docker file to run automation test in JS files

I am trying to create a docker file to run selenium tests for a java script based project. Below is my docker file so far:
#base image
FROM selenium/standalone-chrome
#access to the project within docker container - Bundle app source
COPY ./seleniumTest/project /app
# Install Node.js
RUN sudo apt-get update
RUN sudo apt-get install --yes curl
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
#binding
EXPOSE 8080
#Define runtime
ENTRYPOINT /app/login.test.js
while running with $ docker run -p 4000:80 lamgadekamal/dockertest
returns: Unable to find image 'lamkam/dockertest:latest' locally docker: Error response from daemon: manifest for lamkam/dockertest:latest not found. Could not figure out why am I getting this?
I suspect that you need to build your image first, since the image cannot be found.
Run this command from the same directory where your Dockerfile is located. This will build the image.
docker build -t lamgadekamal/dockertest .
You can then verify that the image exists by running docker images
EDIT: After looking at this again, it appears that you are trying to run the wrong image. You are trying to run lamgadekamal/dockertest, but you built the image with the tag lamkam/dockertest? Seems like you have a typo. I would suggest running docker images to see exactly what is there, but in all likelihood, you need to run lamkam/dockertest.
docker run -p 4000:80 lamkam/dockertest

Create docker image to run selenium tests on different browser versions

I am currently learning to use docker to run selenium tests.
However, to run tests on different versions of the browser, it requires creating our own image.
I tried few ways but failed to run them.
I used the docker file at below path:
https://hub.docker.com/r/selenium/node-chrome/~/dockerfile/
and tried to build the image by using the following command:
docker build -t my-chrome-image --build-arg CHROME_DRIVER_VERSION=2.23 --build-arg CHROME_VERSION=google-chrome-beta=53.0.2785.92-1 NodeChrome
Can anyone guide me on how to implement the same?
Regards,
Ashwin Karangutkar
Use
docker build -t my-chrome-image --build-arg CHROME_DRIVER_VERSION=2.23 --build-arg CHROME_VERSION=google-chrome-beta <path_to_Dockerfile>
I am using elgalu/selenium.
docker run -d --name=grid -p 4444:24444 -p 5900:25900 --shm-size=1g elgalu/selenium
And looking in elgalu looks like you can change the browser versions.
Adding -e FIREFOX_VERSION=38.0.6 to the docker run command.

Is is possible to modify the maven console output to hide the [INFO] logging?

I was wondering if it was possible to modify the output from maven to for example hide the lines that start with [INFO] or to be able to see lines that start with [DEBUG]?
I don't think there is a way to configure it as a logger but mvn -q hides the [INFO] lines and mvn -X shows the debug messages.
Update in 2015: newer versions of maven have added a config file where this is finally possible although as a global per install configuration, check on your $mavenInstallationDir/conf/logging/simplelogger.properties if the file doesn't exist then your maven version is probably too old, I believe it was added on the 3.1 release
You can activate debug output using -X or --debug. For example:
mvn -X install
You can hide INFO messages using -q or --quiet. For example:
mvn -q install
try grepping the output, e.g.
mvn help:evaluate -Dexpression=project.version | grep -v "^\["
From their own docs, you want this:
RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo $RESULT
For reference, see: https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html#forceStdout

How can I download a specific Maven artifact in one command line?

I can install an artifact by install:install-file,
but how can I download an artifact?
For example:
mvn download:download-file -DgroupId=.. -DartifactId=.. -Dversion=LATEST
You could use the maven dependency plugin which has a nice dependency:get goal since version 2.1. No need for a pom, everything happens on the command line.
To make sure to find the dependency:get goal, you need to explicitly tell maven to use the version 2.1, i.e. you need to use the fully qualified name of the plugin, including the version:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
-DrepoUrl=url \
-Dartifact=groupId:artifactId:version
UPDATE: With older versions of Maven (prior to 2.1), it is possible to run dependency:get normally (without using the fully qualified name and version) by forcing your copy of maven to use a given version of a plugin.
This can be done as follows:
1. Add the following line within the <settings> element of your ~/.m2/settings.xml file:
<usePluginRegistry>true</usePluginRegistry>
2. Add the file ~/.m2/plugin-registry.xml with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<pluginRegistry xsi:schemaLocation="http://maven.apache.org/PLUGIN_REGISTRY/1.0.0 http://maven.apache.org/xsd/plugin-registry-1.0.0.xsd"
xmlns="http://maven.apache.org/PLUGIN_REGISTRY/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<useVersion>2.1</useVersion>
<rejectedVersions/>
</plugin>
</plugins>
</pluginRegistry>
But this doesn't seem to work anymore with maven 2.1/2.2. Actually, according to the Introduction to the Plugin Registry, features of the plugin-registry.xml have been redesigned (for portability) and the plugin registry is currently in a semi-dormant state within Maven 2. So I think we have to use the long name for now (when using the plugin without a pom, which is the idea behind dependency:get).
With the latest version (2.8) of the Maven Dependency Plugin, downloading an artifact from the Maven Central Repository is as simple as:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -Dartifact=groupId:artifactId:version[:packaging[:classifier]]
where groupId:artifactId:version, etc. are the Maven coordinates
An example, tested with Maven 2.0.9, Maven 2.2.1, and Maven 3.0.4:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -Dartifact=org.hibernate:hibernate-entitymanager:3.4.0.GA:jar:sources
(Thanks to Pascal Thivent for providing his wonderful answer in the first place. I am adding another answer, because it wouldn't fit in a comment and it would be too extensive for an edit.)
Here's what worked for me to download the latest version of an artifact called "component.jar" with Maven 3.1.1 in the end (other suggestions did not, mostly due to maven version changes I believe)
This actually downloads the file and copies it into the local working directory
From bash:
mvn dependency:get \
-DrepoUrl=http://.../ \
-Dartifact=com.foo.something:component:LATEST:jar \
-Dtransitive=false \
-Ddest=component.jar \
Regarding how to get the artifact binary, Pascal Thivent's answer is it, but to also get the artifact sources jar, we can use:
mvn dependency:get -Dartifact=groupId:artifactId:version:jar:sources
e.g.
mvn dependency:get -Dartifact=junit:junit:4.12:jar:sources
This works because the artifact parameter actually consists of groupId:artifactId:version[:packaging][:classifier]. Just the packaging and classifier are optional.
With jar as packaging and sources as classifier, the maven dependency plugin understands we're asking for the sources jar, not the artifact jar.
Unfortunately for now sources jar files cannot be downloaded transitively, which does make sense, but ideally I do believe it can also respect the option downloadSources just like the maven eclipse plugin does.
One could use dependency:copy (http://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html) which takes a list of artifacts defined in the plugin configuration section and copies them to a specified location, renaming them or stripping the version if desired. This goal can resolve the artifacts from remote repositories if they don't exist in either the local repository or the reactor.
Not all the properties of the plugin could be used in maven CLI. The properties which have "User Property:" property defined could be specified. In the below example I am downloading junit to my temp folder and stripping the vesion from the jar file.
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy -Dartifact=junit:junit:4.11 -DoutputDirectory=/tmp -Dmdep.stripVersion=true
where
artifact=junit:junit:4.11 is the maven coordinates. And you specify artifcat as groupId:artifactId:version[:packaging[:classifier]]
(Thanks to Pascal Thivent for providing his https://stackoverflow.com/a/18632876/2509415 in the first place. I am adding another answer)
The usage from the official documentation:
https://maven.apache.org/plugins/maven-dependency-plugin/usage.html#dependency:get
For my case, see the answer below:
mvn dependency:get -Dartifact=$2:$3:$4:$5 -DremoteRepositories=$1 -Dtransitive=false
mvn dependency:copy -Dartifact=$2:$3:$4:$5 -DremoteRepositories=$1 -Dtransitive=false -DoutputDirectory=$6
#mvn dependency:get -Dartifact=com.huya.mtp:hynswup:1.0.88-SNAPSHOT:jar -DremoteRepositories=http://nexus.google.com:8081/repository/maven-snapshots/ -Dtransitive=false
#mvn dependency:copy -Dartifact=com.huya.mtp:hynswup:1.0.88-SNAPSHOT:jar -DremoteRepositories=http://nexus.google.com:8081/repository/maven-snapshots/ -Dtransitive=false -DoutputDirectory=.
Use the command mvn dependency:get to download the specific artifact and use
the command mvn dependency:copy to copy the downloaded artifact to the destination directory -DoutputDirectory.
one liner to download latest maven artifact without mvn:
curl -O -J -L "https://repository.sonatype.org/service/local/artifact/maven/content?r=central-proxy&g=io.staticcdn.sdk&a=staticcdn-sdk-standalone-optimizer&e=zip&v=LATEST"
maven command:
if you use maven, you can use dependency:copy to download the artifact to the local folder.
mvn dependency:copy -Dartifact=groupId:artifactId:version[:packaging[:classifier]] -DoutputDirectory=<your local path>. -U
Refer: https://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html
Curl command:
# guide: https://help.sonatype.com/repomanager3/rest-and-integration-api/search-api
# https://msnexus.xxxx.com/service/rest/v1/search/assets?sort=version&repository=public&maven.groupId=<groupId>&maven.artifactId=<>&maven.baseVersion=1.46.0-SNAPSHOT&maven.extension=war
download_artifact() {
local host_url=$1
local group_id=$2
local artifact_id=$3
local artifact_type=$4
local artifact_version=$5
local final_name=$6
local location=$7
local search_version=$5
local prerelease="false"
if [[ "${artifact_version}" == *"SNAPSHOT" ]]; then
prerelease="true"
fi
if [[ "${artifact_version}" == "latest"* ]]; then
search_version="*"
fi
assets_url="${host_url}/service/rest/v1/search/assets?sort=version&repository=public&maven.groupId=${group_id}&maven.artifactId=${artifact_id}&maven.baseVersion=${search_version}&prerelease=${prerelease}&maven.extension=${artifact_type}"
echo "INFO: Assets url: $assets_url"
download_url=$(curl "$assets_url" -H "accept: application/json" | jq -r ".items[0].downloadUrl // empty")
echo "INFO: Downloading artifact from url: $download_url"
if [[ -z "$download_url" ]]; then
echo "ERROR: Artifact not exists in Nexus, please check your version [${version}] for [${service_name}]"
exit 1
fi
pre_dir=$(pwd)
if [[ ! -d "$location" ]]; then
mkdir -p $location
fi
cd $location
curl -o "${final_name}.${artifact_type}" "$download_url"
cd $pre_dir
}
Here's an example to get ASM-7 using Maven 3.6:
mvn dependency:get -DremoteRepositories=maven.apache.org -Dartifact=org.ow2.asm:7.0:sources:jar
Or you can download the jar from here: https://search.maven.org/search?q=g:org.ow2.asm%20AND%20a:asm and then
mvn install:install-file -DgroupId=org.ow2.asm -DartifactId=asm -Dversion=7.0 -Dclassifier=sources -Dpackaging=jar -Dfile=/path/to/asm-7.0.jar
To copy artifact in specified location use copy instead of get.
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.2:copy \
-DrepoUrl=someRepositoryUrl \
-Dartifact="com.acme:foo:RELEASE:jar" -Dmdep.stripVersion -DoutputDirectory=/tmp/
You can also do this using docker in PowerShell:
docker run -it --rm -v ${PWD}:/build/source -v ${HOME}/.m2:/build/.m2 --net=host aemdesign/centos-java-buildpack:jdk8 /bin/bash --login -c 'mvn dependency:get -Dmaven.repo.local=/build/.m2/repository -DrepoUrl=https://repo1.maven.org/maven2 -Dartifact=io.prometheus.jmx:jmx_prometheus_javaagent:LATEST -Ddest=/build/source/jmx_prometheus_javaagent.jar'
or in bash:
docker run -it --rm -v $PWD:/build/source -v $HOME/.m2:/build/.m2 --net=host aemdesign/centos-java-buildpack:jdk8 /bin/bash --login -c 'mvn dependency:get -Dmaven.repo.local=/build/.m2/repository -DrepoUrl=https://repo1.maven.org/maven2 -Dartifact=io.prometheus.jmx:jmx_prometheus_javaagent:LATEST -Ddest=/build/source/jmx_prometheus_javaagent.jar'
The command:
mvn install:install-file
Typically installs the artifact in your local repository, so you shouldn't need to download it. However, if you want to share your artifact with others, you will need to deploy the artifact to a central repository see the deploy plugin for more details.
Additionally adding a dependency to your POM will automatically fetch any third-party artifacts you need when you build your project. I.e. This will download the artifact from the central repository.
LATEST is deprecated, try with range [,)
./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get \
-DremoteRepositories=repoId::default::https://nexus/repository/maven-releases/ \
"-Dartifact=com.acme:foo:[,)"
Unfortunately maven-dependency-plugin:get do NOT support version ranges e.g. [2.17.1,) or [,)
If you need download a specific maven artifact but using version range, as I do, look here:
Download Maven artifact with version range