1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-22 06:02:51 +00:00
catalog/task/git-rebase/0.1
2020-07-16 18:35:59 +01:00
..
samples Modifies directory names based on the proposal 2020-07-14 19:01:58 +01:00
git-rebase.yaml This patch splits git-rebase task from the git directory 2020-07-13 13:41:58 +01:00
README.md Modifies the path in readme for samples directory 2020-07-15 02:43:58 +01:00

Git Task

This Task is Git task to work with repositories used by other tasks in your Pipeline.

git-rebase

This task will rebase the branch based on the user input. Before rebase, if squashing of the commits is required, then it can be done by providing the squash count i.e number of commits to squash.

Workspaces

  • source: A workspace that contains the fetched git repository.

Parameters

  • SQUASH_COUNT: Number of commits to squash in the branch. (only required if squashing needs to be performed).
  • COMMIT_MSG: Commit message to add in commit after the squashing is done (only required if squashing needs to be performed).
  • GIT_USER_NAME: Git user name to use for rebase (required).
  • GIT_USER_EMAIL: Git user email to use for rebase (required).
  • PULL_REMOTE_NAME: Git remote name from which we have to pull and rebase.(default: origin).
  • PULL_REMOTE_URL: Git remote URL from which we have to pull and rebase (required to set remote).
  • PULL_BRANCH_NAME: Git branch name from which we have to pull and rebase (required).
  • PUSH_REMOTE_NAME: Git remote name to push after rebase(default: origin).
  • PUSH_REMOTE_URL: Git remote URL to push after rebase(required).
  • PUSH_BRANCH_NAME: Git branch name to push after rebase (required).

Results

  • commit: The precise commit SHA after the rebase.

Usage

This task needs authentication to git in order to push after the rebase. This can be done via secrets and service account. Refer this example to create secret and service account for the git authentication.

Git Rebase pipeline has two tasks, one to clone a git repository in the provided workspace and other to perform rebase operation. Here, git-clone task is used to clone the repository.

A workspace called "shared-workspace" is passed first to the git-clone Task for the code to be checked out on and then to the git-rebase Task to perform the rebase operation.

Remote name, Remote URL and Branch name needs to provided in the input to set the remote in order to perfrom push and pull operations.

Git Rebase pipeline can be referred to create a pipeline and pipelinerun.

NOTE

  • If two factor authentication is enabled in your git account, then access-token for the respective git platform must be provided in the password field while adding secrets.

  • In the params for git-clone task, make sure that param value for depth must be greater than param value for SQUASH_COUNT in git-rebase task.

  • If there are chances for merge conflicts, then that needs to resolved before doing rebase through this task as task will fail, if any merge conflict is found.