-
Notifications
You must be signed in to change notification settings - Fork 201
docs: [AH-1811]: Add new Go Artifact Registry docs #11518
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
Merged
richardblack-Harness
merged 4 commits into
harness:main
from
richardblack-Harness:AH-1811/go-ar
Sep 11, 2025
Merged
Changes from all commits
Commits
Show all changes
4 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
103 changes: 103 additions & 0 deletions
103
docs/artifact-registry/content/supported-formats/go-quickstart.md
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,103 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
This guide will help you **create a Go Artifact Registry** in Harness, **configure an upstream proxy**, and **manage Go modules**. | ||
|
||
## Prerequisites | ||
- Ensure you have **Go** installed and configured on your local machine. | ||
:::info additional information | ||
Depending on your environment, you may need to run additional commands. Go to the [Go installation](https://go.dev/doc/install) guide for more information. | ||
::: | ||
|
||
- Ensure you have access to a Harness account with the appropriate permissions to create registries and connectors. | ||
- Ensure you have [Harness CLI](/docs/platform/automation/cli/install/) installed and running in your local machine. | ||
|
||
--- | ||
## Create a Go Artifact Registry | ||
<Tabs> | ||
<TabItem value="create-registry-interactive" label="Interactive Guide"> | ||
<DocVideo src="https://app.tango.us/app/embed/fa46a7d0-8d78-4666-b2c2-5c0ec0424663?skipCover=true&defaultListView=false&skipBranding=false&makeViewOnly=true&hideAuthorAndDetails=true" title="Create Go Artifact Registry in Harness" /> | ||
</TabItem> | ||
<TabItem value="create-registry-step-by-step" label="Step-by-Step"> | ||
|
||
1. Navigate to the Artifact Registry module in your Harness project. | ||
2. Click on **New Artifact Registry**. | ||
3. In the Registry Type list, select **Go Registry**. | ||
4. Provide a Registry Name. | ||
- The registry name must start with a letter and can include lowercase alphanumeric characters, underscores (`_`), periods (`.`), and hyphens (`-`). | ||
5. Optionally, add a Description and Labels for better organization. | ||
6. Click **Create Registry** to finalize. | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
:::info private go registry | ||
This registry will serve as your private Go registry within Harness. | ||
::: | ||
|
||
--- | ||
## Configure an Upstream Proxy (Optional) | ||
An upstream proxy allows your registry to fetch Go modules from external sources if they are not available locally. | ||
|
||
<Tabs> | ||
<TabItem value="configure-upstream-interactive" label="Interactive Guides"> | ||
|
||
<h3> Create an upstream proxy </h3> | ||
<DocVideo src="https://app.tango.us/app/embed/c029297b-aa2b-4478-b1df-6b9714cba0bf?skipCover=true&defaultListView=false&skipBranding=false&makeViewOnly=true&hideAuthorAndDetails=true" title="Create a Go Upstream Proxy in Harness" /> | ||
|
||
--- | ||
|
||
<h3> Configure the upstream proxy in your registry </h3> | ||
<DocVideo src="https://app.tango.us/app/embed/1db2e18a-aad5-44dd-bab1-e96b4ae98680?skipCover=true&defaultListView=false&skipBranding=false&makeViewOnly=true&hideAuthorAndDetails=true" title="Configure Go Upstream Proxy in Harness" /> | ||
|
||
</TabItem> | ||
<TabItem value="configure-upstream-step-by-step" label="Step-by-Step"> | ||
|
||
<h3> Create an upstream proxy </h3> | ||
1. In the Artifact Registry module, click the dropdown next to **New Artifact Registry** and select **Upstream Proxy**. | ||
2. Choose **Go Registry** as the proxy type. | ||
3. Click **Create Proxy** to establish the connection. | ||
|
||
<h3> Configure the upstream proxy in your registry </h3> | ||
1. In the Artifact Registry module, select an existing Go Artifact Registry. | ||
2. Select the **Configuration** tab. | ||
3. Under **Advanced (Optional)**, select **Configure Upstream**. | ||
4. Select from the list of compatible proxies to add them to your registry. | ||
5. Click **Save** to save the configuration. | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
:::info upstream proxy caching | ||
If a Go module isn’t found in your Harness registry, the upstream proxy fetches it from an external registry like proxy.golang.org, reducing duplication and improving module resolution. | ||
::: | ||
|
||
--- | ||
## Publish & Install Go modules | ||
### Authenticate the Go client | ||
1. In your Harness Go Artifact Registry, click **Setup Client**. | ||
2. Click **Generate Token** to generate an identity token. | ||
3. Export your token with the following command: | ||
```bash | ||
export GOPROXY="https://<email_address>:<TOKEN>@pkg.app.harness.io/pkg/<harness_account_id>/<go-registry-name>/go" | ||
``` | ||
|
||
### Publish a Go package | ||
- Run the following command (using [Harness CLI](/docs/platform/automation/cli/install/)) from your project’s root directory to publish your Go package into your Harness Registry: | ||
|
||
```bash | ||
hns ar push go <REGISTRY_NAME> <ARTIFACT_VERSION> --pkg-url pkg.app.harness.io | ||
``` | ||
|
||
### Install a Go package | ||
- Install your package using `go get`: | ||
```bash | ||
go get <ARTIFACT_NAME>@<VERSION> | ||
``` | ||
|
||
--- | ||
|
||
## Troubleshooting | ||
- Slow downloads or timeouts. Verify network egress to the Harness endpoint. If needed, configure `GOPROXY` explicitly and ensure your client respects it. | ||
- Authentication errors. Ensure your `go env -w GOPRIVATE` and token setup are correctly applied. | ||
- Package not found. Confirm the package was published to the correct Harness registry and that the version tag exists in the repository. |
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
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.