07-generate-artifacts
To generate a downloadable artifact from the CI script use this in your job:
artifacts:
paths:
- report.html
TODO
Write a Python script that will generate an HTML file (report.html
) and add it as an artifact.
-
create a merge request from this issue -
open the WebIDE -
update the .gitlab-ci.yml
file -
add a new job: artefact_generator
belonging topolyglot
-
use the python:slim
image -
add the artifacts
section to the job -
HELLO_MESSAGE
value isHello from Python
-
SOURCE_CODE
contains your Python source code, the content of the HTML file will be:<h1> {message} </h1>
the value of
{message}
is the value ofHELLO_MESSAGE
-
add a script that runs python to execute the content of SOURCE_CODE
-
commit your changes, it will trigger the pipeline -
observe the pipeline -
observe the output of the pipeline Output - Click on the Browse button to display your report
-
merge on master (the pipe will be triggered again)
Help
- Create a file to append content with Python:
f = open(file_name, "a")
- Write content to the file:
f.write('hello world')
- Close the file:
f.close()