인포레터에서 최신 DevOps 트렌드를 격주로 만나보세요!
GitHub Actions
이 문서는 GitHub Actions와 머신 ID에 대한 참조 역할을 합니다. GitHub Actions 사용에 대한 심층 가이드와 GitHub 가입 방법을 사용할 때 사용할 수 있는 구성 옵션에 대한 완전한 설명을 찾을 수 있습니다.
가이드
Machine ID와 GitHub Actions 사용에 대한 단계별 가이드를 읽을 수 있습니다:
- Machine ID를 GitHub Actions와 함께 사용하는 방법: GitHub Actions에서 Teleport 노드에 SSH로 접속하기 위한 Machine ID 사용 방법.
GitHub 가입 토큰
token
리소스는 Teleport 클러스터에 가입할 수 있는 규칙을 설정합니다. 가입 클라이언트는 사용하려는 token
을 지정해야 하며, 이후 그들의 가입 요청에 포함된 정보는 Auth 서버에 의해 token
에 포함된 규칙과 비교되어야 합니다. 이 규칙에 따라 가입이 허용될지 여부가 결정됩니다.
다음 코드는 Machine ID를 사용하여 GitHub으로 가입할 때 token
리소스에서 사용할 수 있는 모든 옵션을 보여줍니다:
kind: token
version: v2
metadata:
# name은 토큰을 식별합니다. 이 토큰을 사용하여 봇이나 노드를 조인하도록 구성할 때는
# 해당 이름이 명시되어야 합니다.
name: github-token
spec:
# Machine ID 및 GitHub 조인의 경우, 역할은 항상 "Bot"이며
# join_method는 항상 "github"가 됩니다.
roles: [Bot]
join_method: github
# bot_name은 이 토큰이 사용될 때 접근을 허용할 봇의 이름을 명시합니다.
bot_name: github-demo
github:
# enterprise_server_host는 GitHub Enterprise Server 인스턴스에서 GitHub Actions 워크플로우로부터
# 조인할 수 있도록 합니다. 일반적인 상황에서는 github.com을 사용하는 경우 이 옵션은 생략해야 합니다.
# GHES를 사용하는 경우, 이 값은 GHES 인스턴스의 호스트 이름으로 구성되어야 합니다.
enterprise_server_host: ghes.example.com
# enterprise_slug는 GitHub Enterprise 조직의 슬러그를 포함시켜
# OIDC 토큰의 예상 발급자에 포함되도록 합니다. 이는 GHE의
# include_enterprise_slug 옵션과의 호환성을 위한 것입니다.
#
# 이 기능이 활성화된 경우, 이 필드는 GitHub Enterprise 조직의 슬러그로 설정해야 합니다.
# 이 기능이 비활성화된 경우, 이 필드는 비워 두어야 합니다.
# `enterprise_server_host` 가 지정된 경우 이 필드는 지정될 수 없습니다.
#
# 사용자 정의 발급자 값에 대한 자세한 정보는
# https://docs.github.com/en/enterprise-cloud@latest/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-issuer-value-for-an-enterprise 를 참조하십시오.
enterprise_slug: slug
# allow는 어떤 GitHub Actions 워크플로우가 조인할 수 있을지를 위한 규칙 구성 배열입니다.
# 모든 allow 항목 내에 구성된 옵션이 충족되어야 GitHub Actions 실행이 조인할 수 있습니다.
# 여러 개의 allow 항목이 지정된 경우, 하나의 항목 내의 모든 옵션을 충족하는 실행은 조인할 수 있습니다.
#
# allow 항목에는 최소한 하나의 항목이 포함되어야 합니다:
# - repository
# - repository_owner
# - sub
allow:
- # repository는 GitHub 리포지토리의 완전한 이름(예: 소유자를 포함한)입니다.
repository: gravitational/teleport
# repository_owner는 리포지토리가 속한 조직 또는 사용자의 이름입니다.
repository_owner: gravitational
# workflow는 GitHub Action 워크플로우 YAML 파일에 구성된 워크플로의 정확한 이름입니다.
workflow: my-workflow
# environment는 GitHub Actions 실행과 관련된 환경입니다.
# GitHub Actions 실행에 환경이 구성되지 않은 경우, 이는 비어 있습니다.
environment: production
# actor는 GitHub Actions 실행을 유발한 GitHub 사용자 이름으로,
# 커밋 또는 워크플로우를 직접 전송하여 발생할 수 있습니다.
actor: octocat
# ref는 액션 실행을 트리거한 git ref입니다.
ref: ref/heads/main
# ref_type은 액션 실행을 트리거한 git ref의 유형입니다.
ref_type: branch
# sub는 워크플로 실행의 다양한 속성을 연결한 문자열입니다.
# GitHub는 이 문자열의 형식을 다음에서 설명합니다:
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#example-subject-claims
sub: repo:gravitational/example-repo:environment:production
GitHub Actions 도우미
우리는 Teleport Machine ID와 GitHub Actions를 사용할 때 워크플로우에서 사용할 수 있는 다양한 즉시 사용 가능한 GitHub Actions를 제공합니다.
각 개별 액션에 대한 더 많은 정보는 해당 GitHub 리포지토리에서 찾을 수 있습니다:
- https://github.com/teleport-actions/setup
- https://github.com/teleport-actions/auth
- https://github.com/teleport-actions/auth-k8s
- https://github.com/teleport-actions/auth-application
이 액션을 사용할 때 문제가 발생하는 경우, 해당 소스 리포지토리에 문제를 제기해 주십시오: https://github.com/teleport-actions/root.