-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Steven Smith <stevsmit@stevsmit-thinkpadt14gen4.remote.csb>
- Loading branch information
Showing
7 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,90 @@ | ||
:_content-type: CONCEPT | ||
[id="quay-mirror-api"] | ||
= Using the API to mirror a repository | ||
|
||
{productname} administrators can mirror external repositories by using the API. | ||
|
||
.Prerequisites | ||
|
||
* You have set `FEATURE_REPO_MIRROR: true` in your `config.yaml` file. | ||
.Procedure | ||
|
||
* Create a new repository mirror configuration by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#createrepomirrorconfig[`POST /api/v1/repository/{repository}/mirror`] endpoint: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X POST "https://<quay-server.example.com>/api/v1/repository/<namespace>/<repo>/mirror" \ | ||
-H "Authorization: Bearer <access_token>" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"is_enabled": <is_enabled>, | ||
"external_reference": "<external_reference>", | ||
"external_registry_username": "<external_registry_username>", | ||
"external_registry_password": "<external_registry_password>", | ||
"sync_start_date": "<sync_start_date>", | ||
"sync_interval": <sync_interval>, | ||
"robot_username": "<robot_username>", | ||
"root_rule": { | ||
"rule": "<rule>", | ||
"rule_type": "<rule_type>" | ||
} | ||
}' | ||
---- | ||
* You can return information about the mirror configuration by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#getrepomirrorconfig[`GET /api/v1/repository/{repository}/mirror`] endpoint: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X GET "https://<quay-server.example.com>/api/v1/repository/<namespace>/<repo>/mirror" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
.Example output | ||
+ | ||
[source,terminal] | ||
---- | ||
{"is_enabled": true, "mirror_type": "PULL", "external_reference": "https://quay.io/repository/argoproj/argocd", "external_registry_username": null, "external_registry_config": {}, "sync_interval": 86400, "sync_start_date": "2025-01-15T12:00:00Z", "sync_expiration_date": null, "sync_retries_remaining": 3, "sync_status": "NEVER_RUN", "root_rule": {"rule_kind": "tag_glob_csv", "rule_value": ["*.latest*"]}, "robot_username": "quayadmin+mirror_robot"} | ||
---- | ||
* You can use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#syncnow[`POST /api/v1/repository/{repository}/mirror/sync-now`] endpoint to sync the repositories. For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X POST "https://<quay-server.example.com>/api/v1/repository/<namespace>/<repo>/mirror/sync-now" \ | ||
-H "Authorization: Bearer <access_token>" | ||
---- | ||
+ | ||
This command does not return output in the CLI. | ||
* Alternatively, you can cancel the sync with the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#synccancel[`POST /api/v1/repository/{repository}/mirror/sync-cancel`] endpoint.For example: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X POST "https://<quay-server.example.com>/api/v1/repository/<namespace>/<repo>/mirror/sync-cancel" \ | ||
---- | ||
+ | ||
This command does not return output in the CLI. | ||
* After creating a mirror configuration, you can make changes with the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#changerepomirrorconfig[`PUT /api/v1/repository/{repository}/mirror`] command. For example, you might choose to disable automatic synchronizations: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ curl -X PUT "https://<quay-server.example.com>/api/v1/repository/<namespace>/<repo>/mirror" \ | ||
-H "Authorization: Bearer <access_token>" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"is_enabled": <false>, <1> | ||
"external_reference": "<external_reference>", | ||
"external_registry_username": "<external_registry_username>", | ||
"external_registry_password": "<external_registry_password>", | ||
"sync_start_date": "<sync_start_date>", | ||
"sync_interval": <sync_interval>, | ||
"robot_username": "<robot_username>", | ||
"root_rule": { | ||
"rule": "<rule>", | ||
"rule_type": "<rule_type>" | ||
} | ||
}' | ||
---- | ||
<1> Disables automatic synchronization. |