I want to create a Jenkins slave as a docker. so I use this Github link to create a Ubuntu Jenkins slave.
In this Dockerfile there is a section that use curl to get a jar file.
curl --create-dirs -sSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/4.0/remoting-4.0.jar
When I want to curl a jar file with curl, didn't work but by any browsers, I could download the jar file.
Why curl bash command doesn't work?
Are you using a proxy in your web browser ?, if so, just:
export http_proxy=http://ip:port
export https_proxy=http://ip:port
Related
I have been able to successfully deploy my locust scripts to Teamcity but I can't find the reports (CSV and HTML) that I specified. I included ls in my command line build step and I can see that the reports are in the working directory. How do I get these reports into the artifacts tab?
My execution command looks like this:
locust -f public_apis/themes.py -u 50 -r 10 -t 300s --headless --print-stats --csv /reports/csv/result_for --csv-full-history --html /reports/html/docker_loadtest_result.html
I'm not familiar with Teamcity, but your paths you're trying to save the reports to suggest Docker could be involved. If that's true, you'd have to ensure you mount a path from the host machine to a volume in Docker and then save the reports there. If you don't, they'll be inside the Docker container if they get created.
How to mount a host directory in a Docker container
I have a swagger file both in yaml format and json. I can view the yaml file on swaggers online viewer https://editor.swagger.io/ but when I try to serve the file locally I get the error:
webbrowser: tried to open "http://localhost:40335/docs", no screen found
After using the command:
swagger serve -F=swagger swagger.yaml
To recreate this scenario you can clone this repo: https://github.com/go-swagger/go-swagger/tree/master/fixtures/goparsing/petstore
Then run the following commands (MAC-OS) to generate the yaml file:
Note: you may have to run these commands in the root of the project using sudo -s
Instructions for windows installation can be found here https://goswagger.io/install.html
Download go-swagger
docker pull quay.io/goswagger/swagger
alias swagger="docker run --rm -it --user $(id -u):$(id -g) -e GOPATH=$HOME/go:/go -v $HOME:$HOME -w $(pwd) quay.io/goswagger/swagger"
swagger version to verify installation
Generate swagger Yaml
4.swagger generate spec -o ./swagger.yaml --scan-models
The swagger file should now be generated but for some reason using the command swagger serve -F=swagger swagger.yaml gives the error described above.
Since you are running it inside a docker container and there's no browser in it you are getting the no screen found error.
This can be fixed by passing the --no-open option to swagger serve ....
Also, specify a fixed port by passing the --port option.
Source: https://goswagger.io/usage/serve_ui.html
Referring the guide below, I'm trying to upload library files to a maven repository on Artifactory; however, I'm having an error.
https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-DeployArtifactsfromArchive
We've installed Artifactory on premise Linux server, and created a maven repository to store libraries for Java app build. It's prepared because our environment does not allow access to public internet and jcenter.
We're planning to configure build job with maven on Jenkins which takes all the necessary libraries from the Artifactory repository.
The library files are given by development team. It follows maven structure because it's exported from Maven on local development PC.
I zipped the files, placed on the server and hit the below code.
curl -u user:password -X PUT http://[artifactory URL]/../[repository name] /tmp/src/archive.zip
Expected successful files upload to the repository.
However, I've got the below error.
{"errors" : [ {
"status" : 403,
"message" : ""
}]
}curl: (3) <url> malformed
I zipped the files, placed on the server and hit the below code.
curl -u user:password -X PUT http://[artifactory URL]/../[repository name] /tmp/src/archive.zip
A few issues here:
As the error suggests, your URL is malformed. There should not be a /../. Just http://[artifactory URL]/[repository name] should be fine.
You're giving curl two bare paths, which it interprets as two URLs that it should PUT to. It's clear that this isn't your intent; the second path is the file you want to upload. You need to specify that by preceding it with, say, a -T.
This call will just upload the zip file into the root of your repository, but you want it to instead extract the contents. As stated by the documentation you linked, this can be done if you pass a header X-Explode-Archive: true or X-Explode-Archive-Atomic: true.
So your call should be something like:
curl -u user:password -X PUT http://[artifactory URL]/[repository name] -T /tmp/src/archive.zip -H 'X-Explode-Archive: true'
I figured out the cause. The reason was because our version is not Artifactory Pro.
I was told it's pro but confirmed the actually installed SW is OSS version.
I want to upload an artifact bundle(jar) to https://oss.sonatype.org via curl command. I am facing issues with URL.
curl -v -u 'username':'password' --upload-file xyz-version-bundle.jar https://oss.sonatype.org/content/repositories/com/abc/xyz/version/
I have tried via above curl command and I have tried many variations in URL but still getting 404 - Repository with ID="com" not found.
Note: The bundle jar file contains all files like pom etc. I am able to upload the same bundle via UI.
This worked for me.
curl -ujorlina2 -u $SONATYPE_USER:$SONATYPE_PASSWORD --request POST -F "file=#xyz-"$VERSION"-bundle.jar" "https://oss.sonatype.org/service/local/staging/bundle_upload"
Here SONATYPE_USER is the username for https://oss.sonatype.org and $SONATYPE_PASSWORD is the password for same.
We have a separate build for the frontend and backend of the application, where we need to pull the dist build of frontend to backend project during the build. During the build the 'curl' cannot write to the desired location.
In detail, we are using SpringBoot as backend for serving Angular 2 frontend. So we need to pull the frontend files to src/main/resources/static folder.
image: maven:3.3.9
pipelines:
default:
- step:
script:
- curl -s -L -v --user xxx:XXXX https://api.bitbucket.org/2.0/repositories/apprentit/rent-it/downloads/release_latest.tar.gz -o src/main/resources/static/release_latest.tar.gz
- tar -xf -C src/main/resources/static --directory src/main/resources/static release_latest.tar.gz
- mvn package -X
As a result of this the build fails with output of CURL.
* Failed writing body (0 != 16360)
Note: I've tried the same with maven-exec-plugin, the result was the same. The solution works on local machine naturally.
I would try running these commands from a local docker run of the image you're specifying (maven:3.3.9). I found that the most helpful way to debug things that were behaving differently in Pipelines vs. in my local environment.
To your specific question yes, you can download external content from the Pipeline run. I have a Pipeline that clones other repos from BitBucket via HTTP into the running container.