GitHub Actions Importer로 Azure DevOps에서 마이그레이션하기

GitHub Actions Importer로 Azure DevOps에서 마이그레이션하기

GitHub Actions Importer를 사용해서 Azure DevOps 파이프라인을 GitHub Actions로 자동 마이그레이션하는 방법을 알려드릴게요. 환경을 구성하고 감사, 예측, 드라이 런, 프로덕션 마이그레이션을 수행하는 방법을 배울 수 있어요.

출처: 문서

본문

About migrating from Azure DevOps with GitHub Actions Importer

아래 지침은 GitHub Actions Importer를 사용해서 Azure DevOps 파이프라인을 GitHub Actions로 마이그레이션하도록 환경을 구성하는 방법을 안내해요.

Prerequisites

  • GitHub Actions 워크플로우로 변환하려는 프로젝트와 파이프라인이 있는 Azure DevOps 계정 또는 조직.

  • 계정 또는 조직에 대한 Azure DevOps personal access token을 만들 수 있는 접근 권한.

  • Linux 기반 컨테이너를 실행하고 필요한 도구를 설치할 수 있는 환경.

    [!NOTE] GitHub Actions Importer 컨테이너와 CLI는 CI 플랫폼과 같은 서버에 설치할 필요가 없어요.

Limitations

GitHub Actions Importer로 Azure DevOps에서 GitHub Actions로 마이그레이션할 때 몇 가지 제한 사항이 있어요.

  • GitHub Actions Importer는 Azure DevOps API 버전 5.0을 요구하며, 이는 Azure DevOps Services 또는 Azure DevOps Server 2019에서 사용할 수 있어요. 더 오래된 Azure DevOps Server 버전은 호환되지 않아요.
  • 소스 코드 체크아웃처럼 Azure DevOps 파이프라인에 암시적으로 추가되는 작업은 GitHub Actions Importer 감사에서 GUID 이름으로 추가될 수 있어요. GUID에 대한 친숙한 작업 이름을 찾으려면 다음 URL을 사용할 수 있어요: https://dev.azure.com/:organization/_apis/distributedtask/tasks/:guid.

Manual tasks

특정 Azure DevOps 구조는 Azure DevOps에서 GitHub Actions 구성으로 수동으로 마이그레이션해야 해요. 여기에는 다음이 포함돼요.

  • 조직, 저장소, 환경 secret
  • OIDC Connect, GitHub Apps, personal access token 같은 서비스 연결
  • 알 수 없는 작업(unknown tasks)
  • 자체 호스팅 에이전트
  • 환경(Environments)
  • 배포 전 승인(Pre-deployment approvals)

수동 마이그레이션에 대한 자세한 내용은 Migrating from Azure Pipelines to GitHub Actions 문서를 참고하세요.

Unsupported tasks

GitHub Actions Importer는 다음 작업의 마이그레이션을 지원하지 않아요.

  • 배포 전 게이트(Pre-deployment gates)
  • 배포 후 게이트(Post-deployment gates)
  • 배포 후 승인(Post-deployment approvals)
  • 일부 리소스 트리거

Installing the GitHub Actions Importer CLI extension

  1. GitHub Actions Importer CLI 확장 프로그램을 설치하세요.

    gh extension install github/gh-actions-importer
    
  2. 확장 프로그램이 설치되었는지 확인하세요.

    $ gh actions-importer -h
    Options:
      -?, -h, --help  Show help and usage information
    
    Commands:
      update     Update to the latest version of GitHub Actions Importer.
      version    Display the version of GitHub Actions Importer.
      configure  Start an interactive prompt to configure credentials used to authenticate with your CI server(s).
      audit      Plan your CI/CD migration by analyzing your current CI/CD footprint.
      forecast   Forecast GitHub Actions usage from historical pipeline utilization.
      dry-run    Convert a pipeline to a GitHub Actions workflow and output its yaml file.
      migrate    Convert a pipeline to a GitHub Actions workflow and open a pull request with the changes.
    

Configuring credentials

configure CLI 명령은 Azure DevOps 및 GitHub 작업 시 GitHub Actions Importer에 필요한 자격 증명과 옵션을 설정하는 데 사용돼요.

  1. GitHub personal access token(classic)을 만드세요. 자세한 내용은 Managing your personal access tokens 문서를 참고하세요.

    토큰에는 workflow 스코프가 있어야 해요.

    토큰을 만든 후 복사해서 나중에 사용할 안전한 위치에 저장하세요.

  2. Azure DevOps personal access token을 만드세요. 자세한 내용은 Azure DevOps 문서의 Use personal access tokens을 참고하세요. 토큰에는 다음 스코프가 있어야 해요.

    • Agents Pool: Read
    • Build: Read
    • Code: Read
    • Release: Read
    • Service Connections: Read
    • Task Groups: Read
    • Variable Groups: Read

    토큰을 만든 후 복사해서 나중에 사용할 안전한 위치에 저장하세요.

  3. 터미널에서 GitHub Actions Importer configure CLI 명령을 실행하세요.

    gh actions-importer configure
    

    configure 명령은 다음 정보를 물어볼 거예요.

    • "Which CI providers are you configuring?"에 대해 화살표 키를 사용해서 Azure DevOps를 선택하고 Space를 눌러 선택한 다음 Enter를 누르세요.
    • "Personal access token for GitHub"에 대해 이전에 만든 personal access token(classic)의 값을 입력하고 Enter를 누르세요.
    • "Base url of the GitHub instance"에 대해 Enter를 눌러 기본값(https://github.com)을 수락하세요.
    • "Personal access token for Azure DevOps"에 대해 이전에 만든 Azure DevOps personal access token 값을 입력하고 Enter를 누르세요.
    • "Base url of the Azure DevOps instance"에 대해 Enter를 눌러 기본값(https://dev.azure.com)을 수락하세요.
    • "Azure DevOps organization name"에 대해 Azure DevOps 조직 이름을 입력하고 Enter를 누르세요.
    • "Azure DevOps project name"에 대해 Azure DevOps 프로젝트 이름을 입력하고 Enter를 누르세요.

    configure 명령의 예시는 아래와 같아요.

    $ gh actions-importer configure
    ✔ Which CI providers are you configuring?: Azure DevOps
    Enter the following values (leave empty to omit):
    ✔ Personal access token for GitHub: ***************
    ✔ Base url of the GitHub instance: https://github.com
    ✔ Personal access token for Azure DevOps: ***************
    ✔ Base url of the Azure DevOps instance: https://dev.azure.com
    ✔ Azure DevOps organization name: :organization
    ✔ Azure DevOps project name: :project
    Environment variables successfully updated.
    
  4. 터미널에서 GitHub Actions Importer update CLI 명령을 실행해서 GitHub Packages Container registry에 연결하고 컨테이너 이미지가 최신 버전으로 업데이트되었는지 확인하세요.

    gh actions-importer update
    

    명령의 출력은 아래와 유사해야 해요.

    Updating ghcr.io/actions-importer/cli:latest...
    ghcr.io/actions-importer/cli:latest up-to-date
    

Perform an audit of Azure DevOps

audit 명령을 사용해서 Azure DevOps 조직의 모든 프로젝트에 대한 높은 수준의 개요를 얻을 수 있어요.

audit 명령은 다음 단계를 수행해요.

  1. Azure DevOps 조직에 정의된 모든 프로젝트를 가져옵니다.
  2. 각 파이프라인을 해당 GitHub Actions 워크플로우로 변환합니다.
  3. GitHub Actions Importer로 가능한 마이그레이션이 얼마나 완전하고 복잡한지 요약한 보고서를 생성합니다.

Running the audit command

Azure DevOps 조직에 대한 감사를 수행하려면 터미널에서 다음 명령을 실행하세요.

gh actions-importer audit azure-devops --output-dir tmp/audit

Inspecting the audit results

지정된 출력 디렉터리의 파일에는 감사 결과가 포함되어 있어요. 감사 결과 요약은 audit_summary.md 파일을 참고하세요.

감사 요약에는 다음 섹션이 있어요.

Pipelines

"Pipelines" 섹션에는 GitHub Actions Importer가 수행한 변환율에 대한 높은 수준의 통계가 포함되어 있어요.

"Pipelines" 섹션에 나타날 수 있는 주요 용어는 다음과 같아요.

  • Successful 파이프라인은 파이프라인 구조와 개별 항목의 100%가 GitHub Actions 등가물로 자동 변환되었음을 의미해요.
  • Partially successful 파이프라인은 모든 파이프라인 구조가 변환되었지만 일부 개별 항목이 GitHub Actions 등가물로 자동 변환되지 않았음을 의미해요.
  • Unsupported 파이프라인은 GitHub Actions Importer가 지원하지 않는 정의 유형이에요.
  • Failed 파이프라인은 변환 중 치명적인 오류가 발생했음을 의미해요. 이는 다음 세 가지 이유 중 하나로 발생할 수 있어요.
    • 파이프라인이 원래 잘못 구성되어 유효하지 않았음.
    • GitHub Actions Importer가 변환 중 내부 오류를 만났음.
    • 네트워크 응답에 실패하여 파이프라인에 접근할 수 없었으며, 이는 종종 잘못된 자격 증명 때문.

Build steps

"Build steps" 섹션에는 모든 파이프라인에서 사용되는 개별 빌드 단계의 개요와 GitHub Actions Importer가 자동으로 변환한 수가 포함되어 있어요.

"Build steps" 섹션에 나타날 수 있는 주요 용어는 다음과 같아요.

  • known 빌드 단계는 해당 액션으로 자동 변환된 단계예요.
  • unknown 빌드 단계는 해당 액션으로 자동 변환되지 않은 단계예요.
  • unsupported 빌드 단계는 다음 중 하나인 단계예요.
    • GitHub Actions에서 근본적으로 지원되지 않음.
    • GitHub Actions와 호환되지 않는 방식으로 구성됨.
  • action 변환된 워크플로우에서 사용된 액션 목록이에요. 이는 다음에 중요할 수 있어요.
    • GitHub Enterprise Server를 사용한다면 인스턴스에 동기화할 액션 목록 수집.
    • 사용되는 액션의 조직 수준 허용 목록(allowlist) 정의. 이 액션 목록은 보안 또는 컴플라이언스 팀이 검토해야 할 수 있는 포괄적인 액션 목록이에요.

Manual tasks

"Manual tasks" 섹션에는 GitHub Actions Importer가 자동으로 완료할 수 없고 직접 수동으로 완료해야 하는 작업의 개요가 포함되어 있어요.

"Manual tasks" 섹션에 나타날 수 있는 주요 용어는 다음과 같아요.

  • secret은 변환된 파이프라인에서 사용되는 저장소 또는 조직 수준 secret이에요. 이 파이프라인이 제대로 작동하려면 이러한 secret을 GitHub Actions에서 수동으로 만들어야 해요. 자세한 내용은 Using secrets in GitHub Actions 문서를 참고하세요.
  • self-hosted runner는 변환된 파이프라인에서 참조되며 GitHub 호스팅 러너가 아닌 러너의 레이블을 의미해요. 이 파이프라인이 제대로 작동하려면 이러한 러너를 직접 정의해야 해요.

Files

감사 보고서의 마지막 섹션은 감사 중 디스크에 기록된 모든 파일의 매니페스트를 제공해요.

각 파이프라인 파일에는 감사에 포함된 다양한 파일이 포함되어 있어요.

  • GitHub에 정의된 원래 파이프라인.
  • 파이프라인 변환에 사용된 네트워크 응답.
  • 변환된 워크플로우 파일.
  • 실패한 파이프라인 변환을 트러블슈팅하는 데 사용할 수 있는 스택 트레이스.

또한 workflow_usage.csv 파일에는 성공적으로 변환된 각 파이프라인이 사용하는 모든 액션, secret, 러너의 쉼표로 구분된 목록이 포함되어 있어요. 이는 어떤 워크플로우가 어떤 액션, secret 또는 러너를 사용하는지 확인하는 데 유용하며, 보안 검토를 수행하는 데도 유용할 수 있어요.

Forecast potential GitHub Actions usage

forecast 명령을 사용해서 Azure DevOps의 완료된 파이프라인 실행에서 지표를 계산해 잠재적인 GitHub Actions 사용량을 예측할 수 있어요.

Running the forecast command

잠재적인 GitHub Actions 사용량 예측을 수행하려면 터미널에서 다음 명령을 실행하세요. 기본적으로 GitHub Actions Importer는 예측 보고서에 이전 7일을 포함해요.

gh actions-importer forecast azure-devops --output-dir tmp/forecast_reports

Inspecting the forecast report

지정된 출력 디렉터리의 forecast_report.md 파일에는 예측 결과가 포함되어 있어요.

예측 보고서에 나타날 수 있는 주요 용어는 다음과 같아요.

  • job count는 완료된 job의 총 수예요.

  • pipeline count는 사용된 고유 파이프라인 수예요.

  • Execution time은 러너가 job에 보낸 시간을 설명해요. 이 지표는 GitHub 호스팅 러너 비용을 계획하는 데 도움이 될 수 있어요.

    이 지표는 GitHub Actions에서 지출할 것으로 예상되는 금액과 상관관계가 있어요. 이는 이러한 분(minutes)에 사용되는 하드웨어에 따라 달라져요. GitHub Actions pricing calculator를 사용해서 비용을 추정할 수 있어요.

  • Queue time 지표는 job이 실행할 러너를 기다리는 데 보낸 시간을 설명해요.

  • Concurrent jobs 지표는 주어진 시간에 실행 중인 job 수를 설명해요. 이 지표는 구성해야 할 러너 수를 정의하는 데 사용할 수 있어요.

또한 이러한 지표는 Azure DevOps의 각 러너 큐에 대해 정의돼요. 호스팅 또는 자체 호스팅 러너, 또는 고사양 또는 저사양 머신이 혼합된 경우 특히 유용하며, 다양한 러너 유형에 특정한 지표를 볼 수 있어요.

Perform a dry-run migration

dry-run 명령을 사용해서 Azure DevOps 파이프라인을 해당 GitHub Actions 워크플로우로 변환할 수 있어요. 드라이 런은 지정된 디렉터리에 출력 파일을 생성하지만 파이프라인을 마이그레이션하기 위한 풀 리퀘스트는 열지 않아요.

GitHub Actions Importer가 자동으로 변환하지 못한 것이 있다면(예: 알 수 없는 빌드 단계 또는 부분적으로 성공한 파이프라인), 사용자 지정 변환기(custom transformers)를 만들어 변환 프로세스를 추가로 사용자 지정할 수 있어요. 자세한 내용은 Extending GitHub Actions Importer with custom transformers 문서를 참고하세요.

Running the dry-run command for a build pipeline

Azure DevOps 빌드 파이프라인을 GitHub Actions로 마이그레이션하는 드라이 런을 수행하려면 터미널에서 다음 명령을 실행하고, pipeline_id를 변환하는 파이프라인의 ID로 바꾸세요.

gh actions-importer dry-run azure-devops pipeline --pipeline-id :pipeline_id --output-dir tmp/dry-run

지정된 출력 디렉터리에서 드라이 런의 로그와 변환된 워크플로우 파일을 볼 수 있어요.

Running the dry-run command for a release pipeline

Azure DevOps 릴리스 파이프라인을 GitHub Actions로 마이그레이션하는 드라이 런을 수행하려면 터미널에서 다음 명령을 실행하고, pipeline_id를 변환하는 파이프라인의 ID로 바꾸세요.

gh actions-importer dry-run azure-devops release --pipeline-id :pipeline_id --output-dir tmp/dry-run

지정된 출력 디렉터리에서 드라이 런의 로그와 변환된 워크플로우 파일을 볼 수 있어요.

Perform a production migration

migrate 명령을 사용해서 Azure DevOps 파이프라인을 변환하고 해당 GitHub Actions 워크플로우로 풀 리퀘스트를 열 수 있어요.

Running the migrate command for a build pipeline

Azure DevOps 빌드 파이프라인을 GitHub Actions로 마이그레이션하려면 터미널에서 다음 명령을 실행하고, target-url 값을 GitHub 저장소의 URL로, pipeline_id를 변환하는 파이프라인의 ID로 바꾸세요.

gh actions-importer migrate azure-devops pipeline --pipeline-id :pipeline_id --target-url https://github.com/octo-org/octo-repo --output-dir tmp/migrate

명령의 출력에는 변환된 워크플로우를 저장소에 추가하는 풀 리퀘스트의 URL이 포함돼요. 성공적인 출력의 예시는 다음과 유사해요.

$ gh actions-importer migrate azure-devops pipeline --target-url https://github.com/octo-org/octo-repo --output-dir tmp/migrate --azure-devops-project my-azure-devops-project
[2022-08-20 22:08:20] Logs: 'tmp/migrate/log/actions-importer-20220916-014033.log'
[2022-08-20 22:08:20] Pull request: 'https://github.com/octo-org/octo-repo/pull/1'

Running the migrate command for a release pipeline

Azure DevOps 릴리스 파이프라인을 GitHub Actions로 마이그레이션하려면 터미널에서 다음 명령을 실행하고, target-url 값을 GitHub 저장소의 URL로, pipeline_id를 변환하는 파이프라인의 ID로 바꾸세요.

gh actions-importer migrate azure-devops release --pipeline-id :pipeline_id --target-url https://github.com/octo-org/octo-repo --output-dir tmp/migrate

명령의 출력에는 변환된 워크플로우를 저장소에 추가하는 풀 리퀘스트의 URL이 포함돼요. 성공적인 출력의 예시는 다음과 유사해요.

$ gh actions-importer migrate azure-devops release --target-url https://github.com/octo-org/octo-repo --output-dir tmp/migrate --azure-devops-project my-azure-devops-project
[2022-08-20 22:08:20] Logs: 'tmp/migrate/log/actions-importer-20220916-014033.log'
[2022-08-20 22:08:20] Pull request: 'https://github.com/octo-org/octo-repo/pull/1'

Inspecting the pull request

migrate 명령의 성공적인 실행 출력에는 변환된 워크플로우를 저장소에 추가하는 새 풀 리퀘스트에 대한 링크가 포함돼요.

풀 리퀘스트의 몇 가지 중요한 요소는 다음과 같아요.

  • 풀 리퀘스트 설명의 Manual steps라는 섹션은 파이프라인을 GitHub Actions로 마이그레이션을 완료하기 전에 직접 완료해야 하는 단계를 나열해요. 예를 들어 이 섹션은 워크플로우에서 사용되는 secret을 만들라고 알려줄 수 있어요.
  • 변환된 워크플로우 파일. 풀 리퀘스트의 Files changed 탭을 선택해서 GitHub 저장소에 추가될 워크플로우 파일을 볼 수 있어요.

풀 리퀘스트 검사를 마치면 병합해서 워크플로우를 GitHub 저장소에 추가할 수 있어요.

Reference

이 섹션에는 GitHub Actions Importer를 사용해서 Azure DevOps에서 마이그레이션할 때의 환경 변수, 선택적 인수, 지원되는 문법에 대한 참조 정보가 포함되어 있어요.

Configuration environment variables

GitHub Actions Importer는 인증 구성에 환경 변수를 사용해요. 이러한 변수는 configure 명령으로 구성 프로세스를 따를 때 설정돼요. 자세한 내용은 Configuring credentials 섹션을 참고하세요.

GitHub Actions Importer는 Azure DevOps 인스턴스에 연결하기 위해 다음 환경 변수를 사용해요.

  • GITHUB_ACCESS_TOKEN: 변환된 워크플로우로 풀 리퀘스트를 만드는 데 사용되는 personal access token(classic)(workflow 스코프 필요).
  • GITHUB_INSTANCE_URL: 대상 GitHub 인스턴스의 URL(예: https://github.com).
  • AZURE_DEVOPS_ACCESS_TOKEN: Azure DevOps 인스턴스로 인증하는 데 사용되는 personal access token. 이 토큰에는 다음 스코프가 필요해요.
    • Build: Read
    • Agent Pools: Read
    • Code: Read
    • Release: Read
    • Service Connections: Read
    • Task Groups: Read
    • Variable Groups: Read
  • AZURE_DEVOPS_PROJECT: 파이프라인을 마이그레이션할 때 사용할 프로젝트 이름 또는 GUID. 모든 프로젝트에 대한 감사를 수행하려면 선택사항이에요.
  • AZURE_DEVOPS_ORGANIZATION: Azure DevOps 인스턴스의 조직 이름.
  • AZURE_DEVOPS_INSTANCE_URL: https://dev.azure.com 같은 Azure DevOps 인스턴스의 URL.

이러한 환경 변수는 GitHub Actions Importer가 실행될 때 로드하는 .env.local 파일에 지정할 수 있어요.

Optional arguments

GitHub Actions Importer 하위 명령에 사용해서 마이그레이션을 사용자 지정할 수 있는 선택적 인수가 있어요.

--source-file-path

forecast, dry-run, 또는 migrate 하위 명령과 함께 --source-file-path 인수를 사용할 수 있어요.

기본적으로 GitHub Actions Importer는 소스 제어에서 파이프라인 내용을 가져와요. --source-file-path 인수는 지정된 소스 파일 경로를 대신 사용하도록 GitHub Actions Importer에 지시해요.

예를 들어:

gh actions-importer dry-run azure-devops pipeline --output-dir ./output/ --source-file-path ./path/to/azure_devops/pipeline.yml

--config-file-path

audit, dry-run, migrate 하위 명령과 함께 --config-file-path 인수를 사용할 수 있어요.

기본적으로 GitHub Actions Importer는 소스 제어에서 파이프라인 내용을 가져와요. --config-file-path 인수는 지정된 소스 파일을 대신 사용하도록 GitHub Actions Importer에 지시해요.

--config-file-path 인수는 변환된 재사용 가능한 워크플로우 또는 복합 액션이 마이그레이션되어야 하는 저장소를 지정하는 데도 사용할 수 있어요.

Audit example

이 예시에서 GitHub Actions Importer는 지정된 YAML 구성 파일을 감사를 수행할 소스 파일로 사용해요.

gh actions-importer audit azure-devops pipeline --output-dir ./output/ --config-file-path ./path/to/azure_devops/config.yml

구성 파일로 Azure DevOps 인스턴스를 감사하려면 구성 파일이 다음 형식이어야 하고 각 repository_slug가 고유해야 해요.

source_files:
  - repository_slug: azdo-project/1
    path: file.yml
  - repository_slug: azdo-project/2
    paths: path.yml

파이프라인의 repository_slug는 Azure DevOps 조직 이름, 프로젝트 이름, 파이프라인 ID를 결합해서 생성할 수 있어요. 예를 들어 my-organization-name/my-project-name/42처럼요.

Dry run example

이 예시에서 GitHub Actions Importer는 지정된 YAML 구성 파일을 드라이 런을 수행할 소스 파일로 사용해요.

파이프라인은 구성 파일의 repository_slug--azure-devops-organization--azure-devops-project 옵션의 값과 일치시켜 선택돼요. 그런 다음 path를 사용해서 지정된 소스 파일을 가져와요.

gh actions-importer dry-run azure-devops pipeline --output-dir ./output/ --config-file-path ./path/to/azure_devops/config.yml
Specify the repository of converted reusable workflows and composite actions

GitHub Actions Importer는 --config-file-path 인수에 제공된 YAML 파일을 사용해서 변환된 재사용 가능한 워크플로우와 복합 액션이 마이그레이션되는 저장소를 결정해요.

먼저 --config-file-path 인수 없이 감사를 실행해야 해요.

gh actions-importer audit azure-devops --output-dir ./output/

이 명령의 출력에는 GitHub Actions Importer가 변환한 모든 재사용 가능한 워크플로우와 복합 액션 목록이 포함된 config.yml 파일이 포함돼요. 예를 들어 config.yml 파일에는 다음 내용이 있을 수 있어요.

reusable_workflows:
  - name: my-reusable-workflow.yml
    target_url: https://github.com/octo-org/octo-repo
    ref: main

composite_actions:
  - name: my-composite-action.yml
    target_url: https://github.com/octo-org/octo-repo
    ref: main

이 파일을 사용해서 재사용 가능한 워크플로우 또는 복합 액션이 추가되어야 하는 저장소와 ref를 지정할 수 있어요. 그런 다음 --config-file-path 인수를 사용해서 config.yml 파일을 GitHub Actions Importer에 제공할 수 있어요. 예를 들어 migrate 명령을 실행할 때 이 파일을 사용해서 구성 파일에 정의된 각 고유 저장소에 대한 풀 리퀘스트를 열 수 있어요.

gh actions-importer migrate azure-devops pipeline --config-file-path config.yml --target-url https://github.com/my-org/my-repo

Supported syntax for Azure DevOps pipelines

다음 표는 GitHub Actions Importer가 현재 변환할 수 있는 속성 유형을 보여줍니다.

Azure Pipelines GitHub Actions Status
condition
  • jobs.<job_id>.if
  • jobs.<job_id>.steps[*].if
Supported
container
  • jobs.<job_id>.container
  • jobs.<job_id>.name
Supported
continuousIntegration
  • on.<push>.<branches>
  • on.<push>.<tags>
  • on.<push>.paths
Supported
job
  • jobs.<job_id>
Supported
pullRequest
  • on.<pull_request>.<branches>
  • on.<pull_request>.paths
Supported
stage
  • jobs
Supported
steps
  • jobs.<job_id>.steps
Supported
strategy
  • jobs.<job_id>.strategy.fail-fast
  • jobs.<job_id>.strategy.max-parallel
  • jobs.<job_id>.strategy.matrix
Supported
timeoutInMinutes
  • jobs.<job_id>.timeout-minutes
Supported
variables
  • env
  • jobs.<job_id>.env
  • jobs.<job_id>.steps.env
Supported
manual deployment
  • jobs.<job_id>.environment
Partially supported
pool
  • runners
  • self hosted runners
Partially supported
services
  • jobs.<job_id>.services
Partially supported
strategy
  • jobs.<job_id>.strategy
Partially supported
triggers
  • on
Partially supported
pullRequest
  • on.<pull_request>.<tags>
Unsupported
schedules
  • on.schedule
  • on.workflow_run
Unsupported
triggers
  • on.<event_name>.types
Unsupported

지원되는 Azure DevOps 작업에 대한 자세한 내용은 github/gh-actions-importer 저장소를 참고하세요.

Environment variable mapping

GitHub Actions Importer는 아래 표의 매핑을 사용해서 기본 Azure DevOps 환경 변수를 GitHub Actions에서 가장 가까운 등가물로 변환해요.

Azure Pipelines GitHub Actions
$(Agent.BuildDirectory) ${{ runner.workspace }}
$(Agent.HomeDirectory) ${{ env.HOME }}
$(Agent.JobName) ${{ github.job }}
$(Agent.OS) ${{ runner.os }}
$(Agent.ReleaseDirectory) ${{ github.workspace}}
$(Agent.RootDirectory) ${{ github.workspace }}
$(Agent.ToolsDirectory) ${{ runner.tool_cache }}
$(Agent.WorkFolder) ${{ github.workspace }}
$(Build.ArtifactStagingDirectory) ${{ runner.temp }}
$(Build.BinariesDirectory) ${{ github.workspace }}
$(Build.BuildId) ${{ github.run_id }}
$(Build.BuildNumber) ${{ github.run_number }}
$(Build.DefinitionId) ${{ github.workflow }}
$(Build.DefinitionName) ${{ github.workflow }}
$(Build.PullRequest.TargetBranch) ${{ github.base_ref }}
$(Build.PullRequest.TargetBranch.Name) ${{ github.base_ref }}
$(Build.QueuedBy) ${{ github.actor }}
$(Build.Reason) ${{ github.event_name }}
$(Build.Repository.LocalPath) ${{ github.workspace }}
$(Build.Repository.Name) ${{ github.repository }}
$(Build.Repository.Provider) GitHub
$(Build.Repository.Uri) ${{ github.server.url }}/${{ github.repository }}
$(Build.RequestedFor) ${{ github.actor }}
$(Build.SourceBranch) ${{ github.ref }}
$(Build.SourceBranchName) ${{ github.ref }}
$(Build.SourceVersion) ${{ github.sha }}
$(Build.SourcesDirectory) ${{ github.workspace }}
$(Build.StagingDirectory) ${{ runner.temp }}
$(Pipeline.Workspace) ${{ runner.workspace }}
$(Release.DefinitionEnvironmentId) ${{ github.job }}
$(Release.DefinitionId) ${{ github.workflow }}
$(Release.DefinitionName) ${{ github.workflow }}
$(Release.Deployment.RequestedFor) ${{ github.actor }}
$(Release.DeploymentID) ${{ github.run_id }}
$(Release.EnvironmentId) ${{ github.job }}
$(Release.EnvironmentName) ${{ github.job }}
$(Release.Reason) ${{ github.event_name }}
$(Release.RequestedFor) ${{ github.actor }}
$(System.ArtifactsDirectory) ${{ github.workspace }}
$(System.DefaultWorkingDirectory) ${{ github.workspace }}
$(System.HostType) build
$(System.JobId) ${{ github.job }}
$(System.JobName) ${{ github.job }}
$(System.PullRequest.PullRequestId) ${{ github.event.number }}
$(System.PullRequest.PullRequestNumber) ${{ github.event.number }}
$(System.PullRequest.SourceBranch) ${{ github.ref }}
$(System.PullRequest.SourceRepositoryUri) ${{ github.server.url }}/${{ github.repository }}
$(System.PullRequest.TargetBranch) ${{ github.event.base.ref }}
$(System.PullRequest.TargetBranchName) ${{ github.event.base.ref }}
$(System.StageAttempt) ${{ github.run_number }}
$(System.TeamFoundationCollectionUri) ${{ github.server.url }}/${{ github.repository }}
$(System.WorkFolder) ${{ github.workspace }}

Templates

GitHub Actions Importer로 Azure DevOps 템플릿을 변환할 수 있어요.

Limitations

GitHub Actions Importer는 몇 가지 제한 사항으로 Azure DevOps 템플릿을 변환할 수 있어요.

  • stages, deployments, jobs 키 아래에서 사용되는 Azure DevOps 템플릿은 GitHub Actions의 재사용 가능한 워크플로우로 변환돼요. 자세한 내용은 Reuse workflows 문서를 참고하세요.
  • steps 키 아래에서 사용되는 Azure DevOps 템플릿은 복합 액션으로 변환돼요. 자세한 내용은 Creating a composite action 문서를 참고하세요.
  • 다른 job 템플릿을 참조하는 job 템플릿이 있다면 GitHub Actions Importer는 템플릿을 재사용 가능한 워크플로우로 변환해요. 재사용 가능한 워크플로우는 다른 재사용 가능한 워크플로우를 참조할 수 없으므로 이는 GitHub Actions에서 잘못된 문법이에요. 중첩된 재사용 가능한 워크플로우를 직접 수정해야 해요.
  • 템플릿이 외부 Azure DevOps 조직이나 GitHub 저장소를 참조한다면 --credentials-file 옵션을 사용해서 이 템플릿에 접근할 자격 증명을 제공해야 해요. 자세한 내용은 Supplemental arguments and settings 문서를 참고하세요.
  • 다음 주의 사항과 함께 each 표현식을 사용해서 YAML을 동적으로 생성할 수 있어요.
    • 중첩된 each 블록은 지원되지 않으며 상위 each 블록도 지원되지 않게 해요.
    • GitHub Actions는 이러한 삽입 방식을 지원하지 않으므로 each 및 포함된 if 조건은 변환 시점에 평가돼요.
    • elseif 블록은 지원되지 않아요. 이 기능이 필요하다면 직접 수정해야 해요.
    • 중첩된 if 블록은 지원되지만 if 조건 아래에 중첩된 if/elseif/else 블록은 지원되지 않아요.
    • 사전 정의된 Azure DevOps 변수를 사용하는 if 블록은 지원되지 않아요.

Supported templates

GitHub Actions Importer는 아래 표에 나열된 템플릿을 지원해요.

Azure Pipelines GitHub Actions Status
Extending from a template Reusable workflow Supported
Job templates Reusable workflow Supported
Stage templates Reusable workflow Supported
Step templates Composite action Supported
Task groups in classic editor Varies Supported
Templates in a different Azure DevOps organization, project, or repository Varies Supported
Templates in a GitHub repository Varies Supported
Variable templates env Supported
Conditional insertion if conditions on job/steps Partially supported
Iterative insertion Not applicable Partially supported
Templates with parameters Varies Partially supported

Template file path names

GitHub Actions Importer는 파일 이름에 변수, 매개변수, 반복 표현식이 있는 상대 또는 동적 파일 경로로 템플릿을 추출할 수 있어요. 단, 기본값이 설정되어 있어야 해요.

Variable file path name example
# File: azure-pipelines.yml
variables:
- template: 'templates/vars.yml'

steps:
- template: "./templates/$"
# File: templates/vars.yml
variables:
  one: 'simple_step.yml'
Parameter file path name example
parameters:
- name: template
  type: string
  default: simple_step.yml

steps:
- template: "./templates/${{ parameters.template }}"
Iterative file path name example
parameters:
- name: steps
  type: object
  default:
  - build_step
  - release_step
steps:
- ${{ each step in parameters.steps }}:
    - template: "$-variables.yml"

Template parameters

GitHub Actions Importer는 아래 표에 나열된 매개변수를 지원해요.

Azure Pipelines GitHub Actions Status
string inputs.string Supported
number inputs.number Supported
boolean inputs.boolean Supported
object inputs.string with fromJSON expression Partially supported
step step Partially supported
stepList step Partially supported
job job Partially supported
jobList job Partially supported
deployment job Partially supported
deploymentList job Partially supported
stage job Partially supported
stageList job Partially supported

[!NOTE] step 키 아래에서 이 매개변수 유형으로 사용되는 템플릿은 단계가 템플릿 단계의 시작 또는 끝에서 사용되는 경우에만 복합 액션으로 직렬화돼요. stage, deployment, job 키 아래에서 이 매개변수 유형으로 사용되는 템플릿은 재사용 가능한 워크플로우로 변환되지 않고 대신 독립형 워크플로우로 직렬화돼요.

일부 내용은 MIT 라이선스에 따라 https://github.com/github/gh-actions-importer/에서 각색되었어요.

MIT License

Copyright (c) 2022 GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

더 알아보기 (Learn more)