I am running a python script in a pipeline on gitlab, which at the end creates two csv files. The pipeline is successful, however the csv files are not created. I tested the process on my local and the files get created.
This is one example of python script which doesn't create the csv file even though the pipeline is successful.
import pandas as pd
data = {
"calories": [420, 380, 390],
"duration": [50, 40, 45]
}
#load data into a DataFrame object:
df = pd.DataFrame(data)
print(df)
df.to_csv('test.csv')
Here is the configuration of the .gitlab-ci.yml file:
to_create:
script:
- python to_create.py
How can I create the test.csv file through the pipeline run on gitlab?
CodePudding user response:
To store the test.csv
as a Job Artifact, you can add the following lines to the .gitlab-ci.yml
file.
to_create:
script:
- python to_create.py
artifacts:
paths:
- test.csv
For every run of this job, a test.csv
file will be stored within GitLab.
Read more about Job Arifacts, here: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html