Jenkins Pipeline - How to upload folder to S3? - jenkins

I have, as I think, simple use case, when jenkins builds static website, so in the end of the build, I have a folder like $WORKSPACE/site-result.
Now I want to upload this folder to S3 (and clean bucket if something already there). How can I do it?
I'm using pipeline, but can switch to freestyle project if necessary. So far I installed S3 Plugin (S3 publisher plugin). Created IAM user. Added credentials to "Configure system" section. And can't find any further info. Thanks!

If the answer suggesting the Pipeline AWS Plugin doesn't work, you could always have an upload step in your pipeline where you use sh call the AWS CLI:
aws s3 cp $WORKSPACE/site-result s3://your/bucket --recursive --include "*"
Source: http://docs.aws.amazon.com/cli/latest/reference/s3/

You have to use s3Upload plugin and set the sourceFile parameter as '*/*'

Related

Upload git repo to S3 bucket from Jenkins without plugin

I am trying to upload git repo through Jenkins job. I cant able to find any documentation related to file upload through Jenkins job. Can any please let me know how to upload git repo from Jenkins job to S3 bucket.
Thanks in advance.
You may use aws cli to accomplish that.
Install aws cli for on the server jenkins is hosted in and make sure jenkins user can use it.
In your Job, set the following Environment Variables:
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
In your jenkins job command use:
aws s3 cp . s3://target-bucket/target-path/ --recursive
And so, your target path will have all the codebase after job completes.

how to configure jenkins pipeline project with no SCM option

We are migrating our source code repository to cloud bucket and all the source code that jenkins uses will be read/downloaded from the bucket like S3.
This also involves rewriting our jenkins pipeline that reads from SCM (git). The Jenkis pipeline project configuration dosen'allow any independent script execution (say weget or download file from bucket using shell)
I would like to do following ,if possibe
1) Download the jenkinsfile from S3 bucket to workspace
2) Choose None for SCM in Pipeline section
3) Give path to downloaded jenkinsfile in script path
My question is , how can I make #1 possible?. Image attached.

Is there any way to get Gitlab pipeline artifacts in Jenkins?

I have a project in gitlab. The project gets built for every check-in in the repo and build artifacts are created when the gitlab pipeline is successful.
I want to get these build artifacts in my jenkins pipeline job. Is there any way to do that?
I couldn't find any plugin in Jenkins to do this.
Any help is appreciated.
The GitLab API offers this with both complete artifacts package (zip) and single files. You need a GitLab token which you can add as a Credential (secret text) and the project number for the pipline you want to copy from. Project ID example of GanttLab Live.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test"

How to deploy ipa archives to artifactory?

Hhaving a CI like jenkins, how to deploy the IPA archives to the jfrog artifactory. Do I need cocoapods or other plugin? Can it be done using standard basic artifactory? What other tools could be used as a replacement?
You can use a simple shell command in Jenkins to execute Artifactory REST api or better yet use Artifactory's CLI to upload any type of file to your Artifactory Server.
HTH,
Or

Jenkins config file provider plugin in a slave

I want to use a config file provided by config file provider plugin in a pipeline project.
However when I run a build step inside a slave. I get a "PermissionDenied" exception, The same runs in master however.
So question is thats the best possible way to share files between master and slaves. I may not be able to Copy to slave plugin as there doesn't seem to be pipeline support.
If you want to share files between stages or nodes you can use the stash - unstash methods. see the example here
If you want to share files between builds you can use the archive method and the Copy Artifact Plugin

Resources