Skip to content

Commit b5f6a24

Browse files
(Update) Rework ImageRepo (#11588)
* (Update) Rework ImageRepo Added clarifications for Image repo, and also consistent documentation for when image info is necessary. to reduce confusion. Added Shared documentation. * quote change * Consistency edits * Resolve URLS properly * Update docs/continuous-integration/shared/imageregistry-whenreq.md Co-authored-by: SushrutHarness <[email protected]> --------- Co-authored-by: SushrutHarness <[email protected]>
1 parent 845c13a commit b5f6a24

13 files changed

+107
-162
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#### What are the expected values for Container Registry and Image
2+
3+
For **Container Registry** settings, provide a Harness container registry connector, such as a [Docker connector](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference/), that connects to a container registry, such as Docker Hub, where the **Image** is located.
4+
5+
For **Image**, provide the FQN (fully-qualified name) or artifact name and tag of the Docker image to use when this step runs commands, for example `us-docker.pkg.dev/gar-prod-setup/harness-public/harness/cache:latest` or `maven:3.8-jdk-11`. If you don't include a tag, Harness uses the `latest` tag. Depending on the connector and feature flags set, **an FQN may be required**.
6+
7+
You can use any Docker image from any Docker registry, including Docker images from private registries. Different container registries require different name formats, for example:
8+
9+
* **Docker Registry:** Input the name of the artifact you want to deploy, such as `library/tomcat`. Wildcards aren't supported. FQN is required for images in private container registries.
10+
* **ECR:** Input the FQN of the artifact you want to deploy. Images in repos must reference a path, for example: `40000005317.dkr.ecr.us-east-1.amazonaws.com/todolist:0.2`.
11+
* **GAR:** Input the FQN of the artifact you want to deploy. Images in repos must reference a path starting with the project ID that the artifact is in, for example: `us-docker.pkg.dev/gar-prod-setup/harness-public/harness/cache:latest`.
12+
13+
![](./static/run-step-settings-03.png)
14+
<figcaption>Configuring a Container Registry and Image settings.</figcaption>
15+
16+
:::note Remove FQN Requirement
17+
Customers who want to utilize non-FQN references for non public Docker-registry connectors will need to contact Harness Support to add the feature flags, `CI_REMOVE_FQN_DEPENDENCY_FOR_PRIVATE_REGISTRY_CONNECTOR_DOCKER` and `CI_REMOVE_FQN_DEPENDENCY`.
18+
:::
19+
20+
#### Pulling images from JFrog Artifactory Docker registries
21+
22+
If you need to pull images from a JFrog Artifactory Docker registry, create a Docker connector that connects to your JFrog instance. **Don't use the Harness Artifactory connector** - The Artifactory connector only supports JFrog non-Docker registries.
23+
24+
To create a Docker connector for a JFrog Docker registry:
25+
26+
1. Go to **Connectors** in your Harness project, organization, or account resources, and select **New Connector**.
27+
2. Select **Docker Registry** under **Artifact Repositories**.
28+
3. Enter a **Name** for the connector. The **Description** and **Tags** are optional.
29+
4. For **Provider Type**, Select **Other**.
30+
5. In **Docker Registry URL**, enter your JFrog URL, such as `https://mycompany.jfrog.io`.
31+
6. In the **Authentication** settings, you must use **Username and Password** authentication.
32+
* **Username:** Enter your JFrog username.
33+
* **Password:** Select or create a [Harness text secret](/docs/platform/secrets/add-use-text-secrets) containing the password corresponding with the **Username**.
34+
7. Complete any other settings and save the connector. For information all Docker Registry connector settings, go to the [Docker connector settings reference](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference).
35+
36+
37+
One completed, please remember to use the FQN location of the image unless you have set the [appropriate feature flags as listed above](#what-are-the-expected-values-for-container-registry-and-image)
38+
39+
:::tip JFrog URLs
40+
The JFrog URL format depends on your Artifactory configuration, and whether your Artifactory instance is local, virtual, remote, or behind a proxy. To get your JFrog URL, you can select your repo in your JFrog instance, select **Set Me Up**, and get the repository URL from the server name in the `docker-login` command.
41+
![](./static/artifactory-connector-settings-reference-09.png)
42+
43+
For more information, go to the JFrog documentation on [Repository Management](https://www.jfrog.com/confluence/display/JFROG/Repository+Management) and [Configuring Docker Repositories](https://www.jfrog.com/confluence/display/RTF/Docker+Registry#DockerRegistry-ConfiguringDockerRepositories).
44+
:::
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#### When are Container Registry and Image required?
2+
3+
The stage's build infrastructure determines whether these fields are required or optional:
4+
5+
* [Kubernetes cluster build infrastructure](/docs/continuous-integration/use-ci/set-up-build-infrastructure/k8s-build-infrastructure/set-up-a-kubernetes-cluster-build-infrastructure.md): **Container Registry** and **Image** are always required.
6+
* [Local runner build infrastructure](/docs/continuous-integration/use-ci/set-up-build-infrastructure/define-a-docker-build-infrastructure.md): **Run Tests** steps can use binaries available on the host machine. The **Container Registry** and **Image** are required if the machine doesn't have the binaries you need.
7+
* [Self-managed AWS/GCP/Azure VM build infrastructure](/docs/category/set-up-vm-build-infrastructures): **Run Tests** steps can use binaries that you've made available on your build VMs. The **Container Registry** and **Image** are required if the VM doesn't have the necessary binaries. These fields are located under **Additional Configuration** for stages that use self-managed VM build infrastructure.
8+
* [Harness Cloud build infrastructure](/docs/continuous-integration/use-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure.md): **Run Tests** steps can use binaries available on Harness Cloud machines, as described in the [image specifications](/docs/continuous-integration/use-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure#platforms-and-image-specifications). The **Container Registry** and **Image** are required if the machine doesn't have the binaries you need. These fields are located under **Additional Configuration** for stages that use Harness Cloud build infrastructure.
15.9 KB
Loading
154 KB
Loading

docs/continuous-integration/use-ci/codebase-configuration/scm-status-checks.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ redirect_from:
1010

1111
import Tabs from '@theme/Tabs';
1212
import TabItem from '@theme/TabItem';
13+
import WhenReq from '/docs/continuous-integration/shared/imageregistry-whenreq.md';
14+
import FQNImage from '/docs/continuous-integration/shared/imageregistry-imagesfqn.md';
1315

1416
If your pipelines use [webhook triggers](/docs/platform/triggers/triggering-pipelines), you can get [Harness build statuses in your PRs](#pipeline-links-in-prs). However, you must configure your protection rules *in your SCM provider* if you want failed/running builds to block PR merges.
1517

@@ -52,10 +54,10 @@ These steps explain how to add a status check that uses the GitHub API. For info
5254
2. Create [GitHub Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) to use for authentication, and save the token as a [Harness text secret](/docs/platform/secrets/add-use-text-secrets).
5355
3. Add a [Run step](../run-step-settings.md) to your **Build** (`CI`) stage.
5456
4. Enter a **Name** for the step.
55-
5. If required by your build infrastructure, provide the **Container Registry** and **Image**.
57+
5. If required by your build infrastructure, provide the **Container Registry** and **Image**. For more information on how to set this up, please [look at the section below about Container Registry and Image](#container-registry-and-image)
5658
* **Container Registry** is a container registry connector, such as a Docker connector.
5759
* **Image** is the FQN or artifact name and tag of a Docker image that has cURL installed, such as `curlimages/curl:latest` for the [official cURL Docker Hub image](https://hub.docker.com/r/curlimages/curl).
58-
* To learn more about this setting and when it is required, go to [Use Run steps - Container Registry and Image](../run-step-settings.md#container-registry-and-image).
60+
* To learn more about this setting and when it is required, [look at the section below about Container Registry and Image](#container-registry-and-image)
5961
6. For **Shell**, select **Sh**.
6062
7. In **Command**, enter a script that calls the GitHub API, for example:
6163

@@ -167,6 +169,14 @@ You can package your status check script in a [custom plugin](../use-drone-plugi
167169
</TabItem>
168170
</Tabs>
169171
172+
### Container Registry and Image
173+
174+
The build environment must have the necessary binaries for the **SCM Status Checks**. Depending on the stage's build infrastructure, **SCM Status Checks** steps can use binaries that exist in the build environment, or use **Container Registry** and **Image** to pull an image, such as a public or private Docker image, that contains the required binaries.
175+
176+
<WhenReq />
177+
178+
<FQNImage />
179+
170180
## Troubleshoot status checks
171181
172182
Go to the [Harness CI Knowledge Base](/kb/continuous-integration/continuous-integration-faqs) for common questions and issues related to codebases and SCM status checks, such as:

docs/continuous-integration/use-ci/manage-dependencies/background-step-settings.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ redirect_from:
1313

1414
import Tabs from '@theme/Tabs';
1515
import TabItem from '@theme/TabItem';
16-
16+
import WhenReq from '/docs/continuous-integration/shared/imageregistry-whenreq.md';
17+
import FQNImage from '/docs/continuous-integration/shared/imageregistry-imagesfqn.md';
1718

1819
Use Background steps to [manage dependent services](./dependency-mgmt-strategies.md) that need to run for the entire lifetime of a Build stage. For example, you can set up your pipeline to run multiple background services that implement a local, multi-service app.
1920

@@ -57,13 +58,11 @@ If the Background step runs directly on the host or in a Kubernetes cluster buil
5758

5859
## Container Registry and Image
5960

60-
**Container Registry** is a Harness container registry connector that connects to the container registry, such as Docker Hub, from which you want Harness to pull an image.
61+
The build environment must have the necessary binaries for the **Background** step to execute your test commands. Depending on the stage's build infrastructure, **Background** steps can use binaries that exist in the build environment, or use **Container Registry** and **Image** to pull an image, such as a public or private Docker image, that contains the required binaries.
6162

62-
**Image** is the container image to use for the background service. The image name should include the tag, or it defaults to the `latest` tag if unspecified. You can use any Docker image from any Docker registry, including Docker images from private registries. Different container registries require different name formats:
63+
<WhenReq />
6364

64-
* **Docker Registry:** Input the name of the artifact you want to deploy, such as `library/tomcat`. Wildcards aren't supported. FQN is required for images in private container registries.
65-
* **ECR:** Input the FQN (fully-qualified name) of the artifact you want to deploy. Images in repos must reference a path, for example: `40000005317.dkr.ecr.us-east-1.amazonaws.com/todolist:0.2`.
66-
* **GAR:** Input the FQN (fully-qualified name) of the artifact you want to deploy. Images in repos must reference a path starting with the project ID that the artifact is in, for example: `us-docker.pkg.dev/gar-prod-setup/harness-public/harness/cache:latest`.
65+
<FQNImage />
6766

6867
<figure>
6968

docs/continuous-integration/use-ci/manage-dependencies/run-docker-in-docker-in-a-ci-stage.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ canonical_url: https://www.harness.io/blog/docker-multi-stage-build
1313

1414
import Tabs from '@theme/Tabs';
1515
import TabItem from '@theme/TabItem';
16+
import WhenReq from '/docs/continuous-integration/shared/imageregistry-whenreq.md';
17+
import FQNImage from '/docs/continuous-integration/shared/imageregistry-imagesfqn.md';
1618

1719
CI pipelines that use a [Kubernetes cluster build infrastructure](/docs/category/set-up-kubernetes-cluster-build-infrastructures) need Docker-in-Docker (DinD) if you need to run Docker commands as part of the build process. For example, if you want to build images from [two separate codebases in the same pipeline](/docs/continuous-integration/use-ci/codebase-configuration/clone-and-process-multiple-codebases-in-the-same-pipeline.md): One with a [Build and Push to Docker step](/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-and-push/build-and-push-to-docker-registry.md) and another with Docker commands in a [Run step](/docs/continuous-integration/use-ci/run-step-settings.md).
1820

@@ -57,8 +59,8 @@ To demonstrate how to set up DinD in Harness CI, this topic creates a pipeline t
5759
In your **Build** stage, select the **Execution** tab, and add a [Background step](./background-step-settings.md) configured as follows:
5860

5961
1. For **Name**, enter `dind_Service`.
60-
2. For **Container Registry**, select your [Docker connector](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference).
61-
3. For **Image**, enter the name and tag for the image that you want to use to run DinD, such as [docker:dind](https://hub.docker.com/_/docker).
62+
2. For **Container Registry**, select your [Docker connector](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference).
63+
3. For **Image**, enter the name and tag for the image that you want to use to run DinD, such as [docker:dind](https://hub.docker.com/_/docker). In some cases, an FQN may be necessary. More information can be found below [about setting up the registry and image](#container-registry-and-image).
6264
4. Under **Additional Configuration**, select **Privileged**. [Privileged mode is required](#privileged-mode-required) Docker-in-Docker to run correctly.
6365
5. In **Entry Point**, you can provide a list of arguments, if needed. For example, the entry point for the `docker:dind` image is `docker-entrypoint.sh`. If you want to add a `--mtu` argument, you would include both the image entry point and the additional argument in the **Entry Point** specification.
6466

@@ -87,7 +89,7 @@ After the **Background** step, add a **Run** step to run your Docker commands. C
8789
8890
1. Enter a **Name**.
8991
2. For **Container Registry**, select your [Docker connector](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference).
90-
3. For **Image**, enter the name and tag for the Docker image, with the Docker binary, that you want to use to execute the content of **Command**.
92+
3. For **Image**, enter the name and tag for the Docker image, with the Docker binary, that you want to use to execute the content of **Command**. In some cases, an FQN may be necessary. More information can be found below [about setting up the registry and image](#container-registry-and-image).
9193
4. In **Command**, enter the shell commands you want to run in this step.
9294
9395
For example, the following commands clone a Git repo, build an image, and push the image to a Docker registry:
@@ -132,6 +134,15 @@ You can also add steps to your pipeline that [run health checks on background se
132134

133135
When you run your pipeline, you can review the step logs on the [Build details page](../viewing-builds.md).
134136

137+
### Container Registry and Image
138+
139+
The build environment must have the necessary binaries for the **DinD** step. Depending on the stage's build infrastructure, **DinD** steps can use binaries that exist in the build environment, or use **Container Registry** and **Image** to pull an image, such as a public or private Docker image, that contains the required binaries.
140+
141+
<WhenReq />
142+
143+
<FQNImage />
144+
145+
135146
## Pipeline YAML example
136147

137148
The following YAML example defines a pipeline that:

docs/continuous-integration/use-ci/run-step-settings.md

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Tabs from '@theme/Tabs';
1616
import TabItem from '@theme/TabItem';
1717
import EnhancedOutVar from '/docs/continuous-integration/shared/enhanced-output-variables.md';
1818
import OutVar from '/docs/continuous-integration/shared/output-var.md';
19+
import FQNImage from '/docs/continuous-integration/shared/imageregistry-imagesfqn.md';
1920

2021
You can use a **Run** step to run commands or scripts in a CI pipeline. Here are some examples of different ways you can use **Run** steps.
2122

@@ -251,56 +252,7 @@ The stage's build infrastructure determines whether these fields are required or
251252

252253
</details>
253254

254-
<details>
255-
<summary>What are the expected values for Container Registry and Image?</summary>
256-
257-
For **Container Registry**, provide a Harness container registry connector, such as a [Docker connector](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference/), that connects to a container registry, such as Docker Hub, where the **Image** is located.
258-
259-
For **Image**, provide the FQN (fully-qualified name) or artifact name and tag of the Docker image to use when this step runs commands, for example `us-docker.pkg.dev/gar-prod-setup/harness-public/harness/cache:latest` or `maven:3.8-jdk-11`. If you don't include a tag, Harness uses the `latest` tag.
260-
261-
You can use any Docker image from any Docker registry, including Docker images from private registries. Different container registries require different name formats, for example:
262-
263-
* **Docker Registry:** Input the name of the artifact you want to deploy, such as `library/tomcat`. Wildcards aren't supported. FQN is required for images in private container registries.
264-
* **ECR:** Input the FQN of the artifact you want to deploy. Images in repos must reference a path, for example: `40000005317.dkr.ecr.us-east-1.amazonaws.com/todolist:0.2`.
265-
* **GAR:** Input the FQN of the artifact you want to deploy. Images in repos must reference a path starting with the project ID that the artifact is in, for example: `us-docker.pkg.dev/gar-prod-setup/harness-public/harness/cache:latest`.
266-
267-
<figure>
268-
269-
![](./static/run-step-settings-03.png)
270-
271-
<figcaption>Configuring a Container Registry and Image settings.</figcaption>
272-
</figure>
273-
274-
</details>
275-
276-
<details>
277-
<summary>Pulling images from JFrog Artifactory Docker registries</summary>
278-
279-
If you need to pull images from a JFrog Artifactory Docker registry, create a Docker connector that connects to your JFrog instance. **Don't use the Harness Artifactory connector** - The Artifactory connector only supports JFrog non-Docker registries.
280-
281-
To create a Docker connector for a JFrog Docker registry:
282-
283-
1. Go to **Connectors** in your Harness project, organization, or account resources, and select **New Connector**.
284-
2. Select **Docker Registry** under **Artifact Repositories**.
285-
3. Enter a **Name** for the connector. The **Description** and **Tags** are optional.
286-
4. For **Provider Type**, Select **Other**.
287-
5. In **Docker Registry URL**, enter your JFrog URL, such as `https://mycompany.jfrog.io`.
288-
6. In the **Authentication** settings, you must use **Username and Password** authentication.
289-
* **Username:** Enter your JFrog username.
290-
* **Password:** Select or create a [Harness text secret](/docs/platform/secrets/add-use-text-secrets) containing the password corresponding with the **Username**.
291-
7. Complete any other settings and save the connector. For information all Docker Registry connector settings, go to the [Docker connector settings reference](/docs/platform/connectors/cloud-providers/ref-cloud-providers/docker-registry-connector-settings-reference).
292-
293-
:::tip JFrog URLs
294-
295-
The JFrog URL format depends on your Artifactory configuration, and whether your Artifactory instance is local, virtual, remote, or behind a proxy. To get your JFrog URL, you can select your repo in your JFrog instance, select **Set Me Up**, and get the repository URL from the server name in the `docker-login` command.
296-
297-
![](./static/artifactory-connector-settings-reference-09.png)
298-
299-
For more information, go to the JFrog documentation on [Repository Management](https://www.jfrog.com/confluence/display/JFROG/Repository+Management) and [Configuring Docker Repositories](https://www.jfrog.com/confluence/display/RTF/Docker+Registry#DockerRegistry-ConfiguringDockerRepositories).
300-
301-
:::
302-
303-
</details>
255+
<FQNImage />
304256

305257
### Shell and Command
306258

0 commit comments

Comments
 (0)