-
Notifications
You must be signed in to change notification settings - Fork 198
(Update) Reponame Updates #11252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KinnonYee-harness
wants to merge
2
commits into
harness:main
Choose a base branch
from
KinnonYee-harness:kinnon-renamerepo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
(Update) Reponame Updates #11252
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: Repo Renaming and Git Experience Caching | ||
description: How to Rename a Repo When Utilizing Git Experience Caching | ||
sidebar_position: 4 | ||
--- | ||
|
||
In the scenario a team wants to change the name of their Git Repo, a team will need to track the pipelines that are affected by this change. This is because changing the repo name can cause odd issues to occur unless the webhook is updated and the pipeline references are updated. | ||
|
||
First, we'll go through the mechanics of what can happen if the repo is updated, but nothing in Harness is updated | ||
|
||
## How do Webhook Events work | ||
Before going through the areas that need to be covered as a result of a repo name change, we should take a look at how Webhook events work between the Git Repository and Harness. | ||
|
||
This can be divided in to two basic operations. | ||
- The first is how changes on the Git provider side get passed to Harness | ||
- The second is how Harness reads changes and picks up changes from the Git provider. | ||
|
||
## What happens when a Repo is Renamed | ||
As an example, let's assume `repoA` was renamed to `repoNew`. We'll use GitHub as an example. | ||
|
||
We'll now look at how to cover the change to the two parts of the webhook events. | ||
|
||
### What happens to events going to Harness when no changes are made | ||
When a repo is renamed, Harness receives a webhook with the updates and sends back a **200 HTTP response**, confirming the data was received. But this data then needs to be routed through our system to update the correct file in the correct branch and repository. | ||
|
||
Because existing Harness resources are still linked to the old repo, `repoA`, they won't be updated. Even if there's a webhook cache for the new repo, `repoNew`, the incoming data won't be connected to the existing resources. | ||
|
||
Harness doesn't receive a specific "renaming" event notification from Git, so it can't automatically cross-reference and update the resources. | ||
|
||
Essentially, to Harness, renaming a repo to `repoNew` looks the same as creating a brand new repo with that name. We interpret the webhook payload the same way in both cases. | ||
|
||
### Why does Harness report no errors accessing files in Github | ||
When a repository is renamed, you might expect the old references to fail immediately. However, this doesn't happen because of how many Git providers, such as **GitHub**, handle these changes. | ||
|
||
Git providers often keep the old references alive after a repo is renamed. Since the link to the old repository still works, Harness doesn't see a broken or unavailable reference. This is why Harness won't show the repo as dead in the UI or detect any unreconciled changes; it still sees the file as available. | ||
|
||
The link to the updated file has moved, but the old link still resolves to it, so Harness's caching system won't detect any changes. Eventually, that old reference might stop working, and you may start to see errors with synchronization and caching. | ||
|
||
## Preventing/Resolving the situation | ||
In order to prevent this situation customers will need to **update their reference file** to the new repo location. For example, for a pipeline | ||
1. Go to the `Pipeline List` for your project | ||
2. Click on the three dots `(...)` at the side of the appropriate pipeline. Select `Edit Git Details` | ||
 | ||
3. Update the information for the new repo, and possibly the new file location. Both have to point to the new existing location of the `yaml` file. | ||
 | ||
4. Click on **Save** | ||
|
||
If the various files are not updated, customers run the risk of having stale data as it is not being updated with changes made in the Git provider. Attempts to cache data will eventually time out, depending on the service. GitHub, for instance, keeps a symlink to the new data location for a period of time, so the data may still appear to be alive and existing, even though it has been moved. | ||
|
||
In addition, **the Webhook for the repository will need to be updated**, if there isn't another existing Webhook caching the new repo location. | ||
|
||
1. Go to the appropriate `Admin Settings` (Project/Organization/Account level) for the webhook | ||
2. Locate the webhook, click on the three dots `(...)` and select **edit** | ||
 | ||
3. Update the repository and save | ||
 | ||
|
||
Once the webhook is updated, it will then re-cache the data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.