@@demo::page_name@@
Defining artifacts is a very simple operation.
To achieve this, you need to have a file named artifacts
in rocketgit directory, in your project directory.
You can have this file in git or you can generate it at build time.
The format of the file is:
local_file_path
map = where to map the file in the artifacts web space
map = another place where to map the same file
content_type = put_here_a_content_type # optional
regex = \.(png|gif|jpg)$ # optional, used only if local_file_path ends with '/'
local_file_path is a file or a directory relative to the repository root
directory. Its use is to specify where to look for files.
If it is a directory, you must append a / char.
Indent the attributes with any amount of spaces/tabs.
The map attribute will map your artifacts to a hierarchy which will be
available in Artifacts sectorion of your repository.
If the map line ends with '/' char, the file name will not be changed.
Inside the map line, you can use the following variables, which will
be replaced by their values:
- env - The environment string (example: debian-10-amd64)
- head - hash of the last commit (example: 58139c7a3b50e08815d5ae97dd6d15dcbfd96000)
- refname - referance name where the commits were pushed (example: ref/heads/main)
- refname_short - short reference name where the commits were pushed (example: main)
- hook_id - The id of the hook which triggered the build (example: 734)
- uid - The uid of the user which pushed (example: 34)
- original_path - the local_file_path string
- original_path_no_ext - the local_file_path string, but without extention
Variables must be enclosed between @@ chars (example: @@env@@).
Optionaly, you can add regex attribute to filter what files you want to
declare as artifacts. It makes sense when local_file_path
is a directory.
Again, optionaly, you can also set a proper content type by adding
a content_type attribute.
It will be usefull when someone will try to download your artifacts,
to allow a proper application to be used to open the file.
If not specified, it will be autodetected.
An example:
build/my_cool_script.sh
map = dir1/@@env@@/@@refname_short@@/
content_type = text/plain
build/my_docs.pdf
map = docs/@@refname_short@@/My new name.pdf
map = docs/latest/My new name.pdf
content_type = application/pdf
./
map = docs/@@refname_short@@/
regex = \.xyz$
content_type = application/xyz
The above example will upload the file build/my_cool_script.sh
to the server in the directory dir1/debian-10-amd64/main/my_cool_script.sh
(please note that the build/ string is stripped).
Also, it will upload the file my_docs.pdf in two places, changing
the name at the same time.
Finally, it will scan the root project directory (./), select all files
with .xyz extention and set the content type to application/xyz.
Please note that the search is not recursive: only the files in the specified
directory are tested.