> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 튜토리얼: 레지스트리 아티팩트 별칭 자동화

> 레지스트리 아티팩트에 "production"과 같은 특정 별칭이 지정되면 웹훅을 실행하는 자동화를 구축하세요.

이 튜토리얼에서는 아티팩트 메타데이터로 트리거되는 **레지스트리** 자동화를 구축하는 방법을 안내합니다. 레지스트리의 아티팩트에 특정 별칭(예: **production**)이 지정되면 W\&B가 웹훅으로 `POST` 요청을 보냅니다. 모델을 정해진 단계로 승격할 때마다 배포 파이프라인, 페이징 서비스, 알림 채널 등의 다운스트림 시스템에 알리려면 이 패턴을 사용하세요. 이 튜토리얼은 레지스트리에서 모델 라이프사이클을 관리하는 ML 엔지니어와 MLOps 실무자를 대상으로 합니다.

<br />

<br />

```mermaid theme={"system"}
flowchart LR
  Event[아티팩트 별칭 추가됨]
  Action[웹훅]
  Event --> Action
```

<br />

<Tip>프로젝트 자동화를 만드는 방법은 [튜토리얼: 프로젝트 run 실패 알림 자동화](/ko/products/wandb/automations/project-automation-tutorial)를 참조하세요.</Tip>

<h2 id="prerequisites">
  사전 요구 사항
</h2>

* **Team Settings**에서 설정한 [웹훅](/ko/products/wandb/automations/create-automations/webhook#create-a-webhook)
* 컬렉션이 하나 이상 있는 W\&B [레지스트리](/ko/products/registry/create_registry). 기존 레지스트리를 재사용해도 됩니다.

<h2 id="create-a-registry-automation">
  레지스트리 자동화 생성
</h2>

레지스트리 범위의 자동화를 설정하면, 레지스트리 내 모든 컬렉션에서 아티팩트에 특정 별칭(예: **production**)이 지정될 때마다 W\&B가 웹훅으로 `POST` 요청을 보냅니다.

1. 레지스트리를 열고 **Automations** 탭을 클릭한 다음 **Create automation**을 클릭하세요.
2. 이벤트로 **An artifact alias is added**를 선택하세요. 대상 별칭(예: **production** 또는 **staging**)과 일치하는 **Alias regex**를 입력하세요.
3. **Next step**을 클릭하세요. **Action type**을 **Webhooks**로 설정하고 사용할 웹훅을 선택하세요. 웹훅에 페이로드가 필요하면 JSON 본문을 붙여 넣고 `${artifact_collection_name}`, `${artifact_version_string}` 같은 [페이로드 변수](/ko/products/wandb/automations/create-automations/webhook#payload-variables)를 사용하세요.
4. **Next step**을 클릭하세요. 자동화 이름과 설명(선택)을 입력한 다음 **Create automation**을 클릭하세요.

자세한 내용은 [웹훅 자동화 만들기](/ko/products/wandb/automations/create-automations/webhook#create-an-automation)(Registry 탭)를 참조하세요.

<h2 id="test-the-automation">
  자동화 테스트
</h2>

자동화가 처음부터 끝까지 제대로 실행되는지 확인하려면 아티팩트 버전에 별칭을 추가하여 설정한 이벤트를 트리거하세요. W\&B App 또는 공개 API를 사용하여 레지스트리의 아티팩트 버전에 별칭(예: **production**)을 추가하면 됩니다. 예를 들면 다음과 같습니다.

```python theme={"system"}
import wandb

with wandb.init(project="my-project") as run:
    artifact = wandb.Artifact("my-model", type="model")
    # ... 필요에 따라 아티팩트에 파일이나 메타데이터를 로깅합니다 ...
    run.log_artifact(artifact)
    run.wait()  # 다음 단계로 넘어가기 전에 아티팩트 로깅이 완료될 때까지 기다립니다

# 컬렉션의 최신 버전에 별칭을 추가합니다
api = wandb.Api()
collection = api.artifact_collection(name="my-model", type_name="model")
version = next(collection.versions())  # 최신 버전을 조회합니다

version.aliases.append("production")
version.save()
print("Added alias 'production' to", version.name)

```

잠시 후 웹훅 엔드포인트에 설정한 페이로드가 담긴 `POST` 요청이 전송됩니다. 이제 이 레지스트리의 아티팩트에 조건과 일치하는 별칭이 적용될 때마다 실행되는 레지스트리 자동화가 완성되었습니다.

<h2 id="go-further">
  더 알아보기
</h2>

W\&B 자동화에 대해 이 튜토리얼에서 다루지 않은 내용을 더 알아보려면 다음 리소스를 참조하세요:

* 프로젝트 및 레지스트리의 모든 이벤트 유형에 대한 [Automation events and scopes](/ko/products/wandb/automations/automation-events).
* 전체 UI 및 페이로드 세부 정보에 대한 [Slack 자동화 만들기](/ko/products/wandb/automations/create-automations/slack) 및 [웹훅 자동화 만들기](/ko/products/wandb/automations/create-automations/webhook).


## Related topics

- [튜토리얼: 프로젝트 run 실패 알림 자동화](/ko/products/wandb/automations/project-automation-tutorial.md)
