Skip to content

git Submodule

Structs

GitMirrorProps

Initializer

from gcix import git

git.GitMirrorProps(
  remote_repository: str,
  git_config_user_email: str = None,
  git_config_user_name: str = None,
  job_name: str = None,
  job_stage: str = None,
  private_key_variable: str = None,
  run_only_for_repository_url: str = None,
  script_hook: typing.List[str] = None
)

Properties

Name Type Description
remote_repository str The git repository the code of the pipelines repository should be mirrored to.
git_config_user_email str The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.
git_config_user_name str The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.
job_name str The name of the Bootstrap job.
job_stage str The stage of the Bootstrap job.
private_key_variable str DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.
run_only_for_repository_url str When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.
script_hook typing.List[str] This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.

remote_repositoryRequired
remote_repository: str
  • Type: str

The git repository the code of the pipelines repository should be mirrored to.


git_config_user_emailOptional
git_config_user_email: str
  • Type: str

The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.


git_config_user_nameOptional
git_config_user_name: str
  • Type: str

The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.


job_nameOptional
job_name: str
  • Type: str

The name of the Bootstrap job.


job_stageOptional
job_stage: str
  • Type: str

The stage of the Bootstrap job.


private_key_variableOptional
private_key_variable: str
  • Type: str

DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.


run_only_for_repository_urlOptional
run_only_for_repository_url: str
  • Type: str

When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.

With this variable the job only runs, when its value matches the CI_REPOSITORY_URL of the current repository.


script_hookOptional
script_hook: typing.List[str]
  • Type: typing.List[str]

This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.

This hook is mostly meant to be for git configuration commands, required to push to the remote repository.


Classes

GitMirror

This job clones the CI_COMMIT_REF_NAME of the current repository and forcefully pushes this REF to the remote_repository.

This subclass of Job will configure following defaults for the superclass:

  • name: git-mirror
  • stage: deploy
  • image: PredefinedImages.ALPINE_GIT

Initializers

from gcix import git

git.GitMirror(
  remote_repository: str,
  git_config_user_email: str = None,
  git_config_user_name: str = None,
  job_name: str = None,
  job_stage: str = None,
  private_key_variable: str = None,
  run_only_for_repository_url: str = None,
  script_hook: typing.List[str] = None
)
Name Type Description
remote_repository str The git repository the code of the pipelines repository should be mirrored to.
git_config_user_email str The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.
git_config_user_name str The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.
job_name str The name of the Bootstrap job.
job_stage str The stage of the Bootstrap job.
private_key_variable str DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.
run_only_for_repository_url str When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.
script_hook typing.List[str] This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.

remote_repositoryRequired
  • Type: str

The git repository the code of the pipelines repository should be mirrored to.


git_config_user_emailOptional
  • Type: str

The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.


git_config_user_nameOptional
  • Type: str

The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.


job_nameOptional
  • Type: str

The name of the Bootstrap job.


job_stageOptional
  • Type: str

The stage of the Bootstrap job.


private_key_variableOptional
  • Type: str

DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.


run_only_for_repository_urlOptional
  • Type: str

When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.

With this variable the job only runs, when its value matches the CI_REPOSITORY_URL of the current repository.


script_hookOptional
  • Type: typing.List[str]

This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.

This hook is mostly meant to be for git configuration commands, required to push to the remote repository.


Methods

Name Description
add_dependencies No description.
add_needs No description.
add_parent This method is called by gcix.JobCollections when the job is added to that JobCollection.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_allow_failure No description.
assign_artifacts No description.
assign_cache No description.
assign_dependencies No description.
assign_image Sets the image of this job.
assign_needs No description.
assign_tags No description.
copy Returns an independent, deep copy object of this job.
extend_name This method is used by gcix.JobCollections to populate the jobs name.
extend_stage This method is used by gcix.JobCollections to populate the jobs name and stage.
extend_stage_value This method is used by gcix.JobCollections to populate the jobs stage.
get_all_instance_names Return all instance names from the given child.
is_equal isEqual checks if this object is equal to given object.
prepend_rules No description.
prepend_scripts No description.
render Returns a representation of any object which implements IBase.

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]]

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]]

add_parent
1
2
3
def add_parent(
  parent: typing.Union[Job, JobCollection]
) -> None

This method is called by gcix.JobCollections when the job is added to that JobCollection.

The job needs to know its parents when getAllInstanceNames() is called.

parentRequired
  • Type: typing.Union[gcix.Job, gcix.JobCollection]

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Job
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[gcix.Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

assign_allow_failure
1
2
3
def assign_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> Job
allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> Job
artifactsRequired
  • Type: gcix.Artifacts

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> Job
cacheRequired
  • Type: gcix.Cache

assign_dependencies
1
2
3
def assign_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]]

assign_image
1
2
3
def assign_image(
  image: typing.Union[str, Image]
) -> Job

Sets the image of this job.

For a simple container image you can provide the origin of the image. If you want to set the entrypoint, you have to provide an Image object instead.

!! Any previous values will be overwritten.

imageRequired
  • Type: typing.Union[str, gcix.Image]

assign_needs
1
2
3
def assign_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]]

assign_tags
1
2
3
def assign_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

copy
def copy() -> Job

Returns an independent, deep copy object of this job.

extend_name
1
2
3
def extend_name(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name.

nameRequired
  • Type: str

extend_stage
1
2
3
def extend_stage(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name and stage.

stageRequired
  • Type: str

extend_stage_value
1
2
3
def extend_stage_value(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs stage.

stageRequired
  • Type: str

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this sequence and all parent sequences.

childOptional
  • Type: typing.Union[gcix.Job, gcix.JobCollection]

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired
  • Type: gcix.IBase

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[gcix.Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
tags typing.List[str] Getter method to receive added tags.
allow_failure typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
name str No description.
ordered_tags gcix.OrderedStringSet No description.
parents typing.List[typing.Union[gcix.Job, gcix.JobCollection]] No description.
scripts typing.List[str] No description.
stage str No description.
artifacts gcix.Artifacts No description.
cache gcix.Cache No description.
dependencies typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]] No description.
image gcix.Image No description.
needs typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]] No description.
original gcix.Job No description.
rules typing.List[gcix.Rule] No description.
variables typing.Mapping[str] No description.
git_config_user_email str The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.
git_config_user_name str The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.
remote_repository str The git repository the code of the pipelines repository should be mirrored to.
script_hook typing.List[str] This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.
private_key_variable str DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.
run_only_for_repository_url str When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.

tagsRequired
tags: typing.List[str]
  • Type: typing.List[str]

Getter method to receive added tags.


allow_failureRequired
allow_failure: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

nameRequired
name: str
  • Type: str

ordered_tagsRequired
ordered_tags: OrderedStringSet
  • Type: gcix.OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection]]

scriptsRequired
scripts: typing.List[str]
  • Type: typing.List[str]

stageRequired
stage: str
  • Type: str

artifactsOptional
artifacts: Artifacts
  • Type: gcix.Artifacts

cacheOptional
cache: Cache
  • Type: gcix.Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]]

imageOptional
image: Image
  • Type: gcix.Image

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]
  • Type: typing.List[typing.Union[gcix.Job, gcix.JobCollection, gcix.Need]]

originalOptional
original: Job
  • Type: gcix.Job

rulesOptional
rules: typing.List[Rule]
  • Type: typing.List[gcix.Rule]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

git_config_user_emailRequired
git_config_user_email: str
  • Type: str

The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.


git_config_user_nameRequired
git_config_user_name: str
  • Type: str

The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.


remote_repositoryRequired
remote_repository: str
  • Type: str

The git repository the code of the pipelines repository should be mirrored to.


script_hookRequired
script_hook: typing.List[str]
  • Type: typing.List[str]

This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.

This hook is mostly meant to be for git configuration commands, required to push to the remote repository.


private_key_variableOptional
private_key_variable: str
  • Type: str

DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.


run_only_for_repository_urlOptional
run_only_for_repository_url: str
  • Type: str

When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.

With this variable the job only runs, when its value matches the CI_REPOSITORY_URL of the current repository.


Protocols

IGitMirror

  • Implemented By: gcix.aws.CdkMirrorToCodecommit, GitMirror, gcix.aws.ICdkMirrorToCodecommit, IGitMirror

Properties

Name Type Description
git_config_user_email str The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.
git_config_user_name str The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.
remote_repository str The git repository the code of the pipelines repository should be mirrored to.
script_hook typing.List[str] This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.
private_key_variable str DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.
run_only_for_repository_url str When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.

git_config_user_emailRequired
git_config_user_email: str
  • Type: str

The 'user.email' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_EMAIL.


git_config_user_nameRequired
git_config_user_name: str
  • Type: str

The 'user.name' with which the commits to the remote repository should be made. Defaults to GITLAB_USER_NAME.


remote_repositoryRequired
remote_repository: str
  • Type: str

The git repository the code of the pipelines repository should be mirrored to.


script_hookRequired
script_hook: typing.List[str]
  • Type: typing.List[str]

This list of strings could contain any commands that should be executed between pulling the current repository and pushing it to the remote.

This hook is mostly meant to be for git configuration commands, required to push to the remote repository.


private_key_variableOptional
private_key_variable: str
  • Type: str

DO NOT PROVIDE YOUR PRIVATE SSH KEY HERE!!! This parameter takes the name of the Gitlab environment variable, which contains the private ssh key used to push to the remote repository. This one should be created as protected and masked variable in the 'CI/CD' settings of your project.


run_only_for_repository_urlOptional
run_only_for_repository_url: str
  • Type: str

When mirroring to a remote Gitlab instance, you don't want to run this mirroring job there again.

With this variable the job only runs, when its value matches the CI_REPOSITORY_URL of the current repository.