user1298426
user1298426

Reputation: 3717

jenkins - How to attach generated output file from the script to the jenkins job

I have a jenkins job which calls the python script which does some processing to the csv file and then exports it to another csv. I want this csv to be downloaded on user's machine who trigger the jenkins job or attached the same file to the jenkins job. Here is what python script does.

file1 = pd.read_csv(sys.argv[1])
...
file1.to_csv("file2.csv")

This to_csv function generates csv which I want to give back to the user. How to do that in jenkins. Would post build action help to download or attach tge

Upvotes: 0

Views: 1431

Answers (1)

Sriram
Sriram

Reputation: 165

If you are using a Freestyle Project in Jenkins, you can Archive the artifacts present in Post Build Actions, there you can either provide the file name or the pattern as below:

'module/dist/**/*.csv'.

The module/dist are just examples of folders & subfolders in your workspace where the jenkins job runs.

Once the build is run, you can provide the URL: as http://{YOUR_JENKINS_URL}/job/{YOUR_JOB_NAME}/{CURRENT_BUILD_NO}/artifact/{YOUR_CSV_FILE}

Once the job is run, you check your job's current build for artifacts and cross check the URL.

Upvotes: 1

Related Questions