API

Generator

Generate index page with links to all previously archived folders during a tag build

class lightweight_versioned_gitlab_pages.generate.TagInfo(tag: gitlab.v4.objects.tags.ProjectTag, commit: gitlab.v4.objects.commits.ProjectCommit, created_at: datetime.datetime, job_id: int = -1, pages_url: str = '', job_ids: List[Dict[str, int]] = <factory>)[source]

Bases: object

lightweight_versioned_gitlab_pages.generate.create_html_files(tag_list: List[TagInfo], path: Path, template: Optional[Path] = None) None[source]

Create all HTML files.

Parameters
  • tag_list (List[TagInfo]) – The tag list

  • path (Path) – The path to the output folder

  • template (Optional[Path]) – Path to custom template file

lightweight_versioned_gitlab_pages.generate.create_output_directory(path: Path) None[source]

Create the output directory.

Parameters

path (Path) – The path to the output directory

lightweight_versioned_gitlab_pages.generate.get_artifact_url(web_url: str, job_id: int, folder: str, index_file: str) str[source]

Create the artifact URL.

Parameters
  • web_url (str) – The web url

  • job_id (int) – The job identifier

  • folder (str) – The folder

  • index_file (str) – The index file

Returns

The artifact URL.

Return type

str

lightweight_versioned_gitlab_pages.generate.get_pipeline_job(project: Project, tag_info: TagInfo, job_name: str, web_url: str) None[source]

Get the pipeline job informations and set the tag info values.

Parameters
  • project (Project) – The project

  • tag_info (TagInfo) – The tag information

  • job_name (str) – The job name

  • web_url (str) – The web url

lightweight_versioned_gitlab_pages.generate.get_project(url: str, private_token: str, project_id: int) Project[source]

Get the GitLab project.

Parameters
  • url (str) – The url

  • private_token (str) – The private token

  • project_id (int) – The project identifier

Returns

The project.

Return type

Project

lightweight_versioned_gitlab_pages.generate.get_project_tags(project: Project, job_name: str, web_url: str) List[TagInfo][source]

Get all project tags.

Parameters
  • project (Project) – The project

  • job_name (str) – The job name

  • web_url (str) – The web url

Returns

The project tags.

Return type

List[TagInfo]

lightweight_versioned_gitlab_pages.generate.get_template_file(file_name: str, template_folder: Optional[Path] = None) Template[source]

Get the Jinja2 template file.

Parameters
  • file_name (str) – The template file name

  • template_folder (Path) – The template folder

Returns

The template.

Return type

Template

lightweight_versioned_gitlab_pages.generate.parse_arguments() Namespace[source]

Parse CLI arguments. :raise argparse.ArgumentError Argparse error :return: argparse object

lightweight_versioned_gitlab_pages.generate.parser_valid_file(parser: ArgumentParser, arg: str) Path[source]

Determine whether file exists.

Parameters
  • parser (parser object) – The parser

  • arg (str) – The file to check

Raises

argparse.ArgumentError – Argument is not a file

Returns

Input file path, parser error is thrown otherwise.

Return type

Path

lightweight_versioned_gitlab_pages.generate.save_file(content: str, path: Path) None[source]

Save data to a file.

Parameters
  • content (str) – The content

  • path (Path) – The path

lightweight_versioned_gitlab_pages.generate.save_version_info_file(tag_list: List[TagInfo], file_path: Path) None[source]

Save a version information file.

Parameters
  • tag_list (List[TagInfo]) – The tag list

  • file_path (Path) – The file path