Skip to main content

補助的な引数と設定

GitHub Actions Importer には、ニーズに合わせて移行プロセスを調整するための補足的な引数と設定がいくつかあります。

この記事では、省略可能なパラメーター、パス引数、ネットワーク設定など、GitHub Actions Importer の補助的な引数と設定を構成するための一般的な情報を提供します。

省略可能なパラメーター

GitHub Actions Importer には、移行プロセスをカスタマイズするために使用できる省略可能なパラメーターがいくつかあります。

許可されるアクションの制限

次のオプションを使うと、変換後のワークフローで許可されるアクションを制限できます。 これらのオプションを組み合わせて使うと、許可されるアクションの一覧が展開されます。 これらのオプションをいずれも指定しない場合は、すべてのアクションが許可されます。

  •         `--allowed-actions` は、変換後のワークフローで許可するアクションの一覧を指定します。 ワイルドカードを利用できます。 指定されたもの以外のアクションは許可されません。
    

    次に例を示します。

    --allowed-actions actions/checkout@v5 actions/upload-artifact@* my-org/*
    

    空の一覧を指定すると、すべてのアクションは許可されません。 たとえば、「 --allowed-actions= 」のように入力します。

  •         `--allow-verified-actions` は、確認された作成者からのすべてのアクションが許可されることを指定します。
    
  •         `--allow-github-created-actions` は、`github` または `actions` 組織から発行されたアクションが許可されることを指定します。
    

    たとえば、github/super-linteractions/checkout のようなアクションです。

    このオプションは、--allowed-actions actions/* github/* と同等です。

認証に資格情報ファイルを使う

          `--credentials-file` パラメーターでは、GitHub Actions Importer が認証できる異なるサーバーの資格情報を含むファイルへのパスを指定します。 これは、ビルド スクリプト (`.travis.yml` や `jenkinsfile` など) が複数の GitHub Enterprise Server インスタンスに格納されている場合に便利です。

資格情報ファイルは、サーバーとアクセス トークンの組み合わせの一覧を含む YAML ファイルである必要があります。 GitHub Actions Importer は、実行中のネットワーク要求に最もよく一致する URL の資格情報を使います。

次に例を示します。

- url: https://github.com
  access_token: ghp_mygeneraltoken
- url: https://github.com/specific_org/
  access_token: ghp_myorgspecifictoken
- url: https://jenkins.org
  access_token: abc123
  username: marty_mcfly

上記の資格情報ファイルの場合、GitHub Actions Importer はアクセス トークン ghp_mygeneraltoken を使って https://github.com へのすべてのネットワーク要求を認証しますが、ネットワーク要求が __ 組織内のリポジトリに対するものである場合を "除きます"。specific_org この場合、代わりに ghp_myorgspecifictoken トークンが認証に使われます。

代替ソース コード プロバイダー

GitHub Actions Importer は、GitHub 以外のリポジトリからソース コードを自動的にフェッチできます。 資格情報ファイルでは、provider、プロバイダーの URL、ソース コードを取得するために必要な資格情報を指定できます。

次に例を示します。

- url: https://gitlab.com
  access_token: super_secret_token
  provider: gitlab

上記の例では、GitHub Actions Importer はトークン super_secret_token を使って、https://gitlab.com でホストされているすべてのソース コードを取得します。

          `provider` でサポートされている値を次に示します。

* github (既定値)

  • gitlab
  • bitbucket_server
  • azure_devops

オプション機能を制御する

          `--features` オプションを使うと、GitHub Actions Importer によって作成されるワークフローで使う機能を制限できます。 これは、以前の GitHub Actions インスタンスに移行するときに、新しい GitHub Enterprise Server 構文をワークフローから除外する場合に便利です。 
          `--features` オプションを使う場合、移行先の GitHub Enterprise Server のバージョンを指定する必要があります。

次に例を示します。

gh actions-importer dry-run ... --features ghes-3.3
          `--features` でサポートされている値を次に示します。

* all (既定値)

  • ghes-latest
  •         `ghes-<number>`。ここで、`<number>` は GitHub Enterprise Server のバージョンで、`3.0` またはそれ以降です。 たとえば、「 `ghes-3.3` 」のように入力します。
    
            `list-features` コマンドを実行すると、GitHub Actions Importer で使用可能な機能フラグのリストを表示できます。 次に例を示します。
    
Shell
gh actions-importer list-features

次のような出力が表示されます。

Available feature flags:

actions/cache (disabled):
        Control usage of actions/cache inside of workflows. Outputs a comment if not enabled.
        GitHub Enterprise Server >= ghes-3.5 required.

composite-actions (enabled):
        Minimizes resulting workflow complexity through the use of composite actions. See https://docs.github.com/en/actions/creating-actions/creating-a-composite-action for more information.
        GitHub Enterprise Server >= ghes-3.4 required.

reusable-workflows (disabled):
        Avoid duplication by re-using existing workflows. See https://docs.github.com/en/actions/using-workflows/reusing-workflows for more information.
        GitHub Enterprise Server >= ghes-3.4 required.

workflow-concurrency-option-allowed (enabled):
        Allows the use of the `concurrency` option in workflows. See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency for more information.
        GitHub Enterprise Server >= ghes-3.2 required.

Enable features by passing --enable-features feature-1 feature-2
Disable features by passing --disable-features feature-1 feature-2

機能フラグを切り替えるには、次のいずれかの方法を使うことができます。 * --enable-features コマンドを実行するときに、--disable-features オプションと gh actions-importer オプションを使います。

  • 各機能フラグに環境変数を使います。

            `--enable-features` オプションと `--disable-features` オプションを使って、コマンドの期間を有効または無効にする特定の機能を選ぶことができます。
    

たとえば、次のコマンドを使うと、actions/cachecomposite-actions の使用が無効になります。

gh actions-importer dry-run ... --disable-features=composite-actions actions/cache
          `configure --features` コマンドを使って、機能フラグを対話形式で構成し、環境に自動的に書き込むことができます。
$ gh actions-importer configure --features

✔ Which features would you like to configure?: actions/cache, reusable-workflows
✔ actions/cache (disabled): Enable
? reusable-workflows (disabled):
› Enable
  Disable

ネットワーク応答キャッシュの無効化

既定では、GitHub Actions Importer はネットワーク要求からの応答をキャッシュして、ネットワークの負荷を軽減し、実行時間を短縮します。 --no-http-cache オプションを使うと、ネットワーク キャッシュを無効にできます。 次に例を示します。

gh actions-importer forecast ... --no-http-cache

パス引数

GitHub Actions Importer を実行する場合、パス引数はコンテナーのディスクに対する相対パスであり、コンテナーのホスト コンピューターに対する絶対パスはサポートされていません。 GitHub Actions Importer が実行されると、コンテナーの /data ディレクトリは GitHub Actions Importer が実行されたディレクトリにマウントされます。

たとえば、次のコマンドを /Users/mona ディレクトリで使用すると、GitHub Actions Importer 監査の概要が /Users/mona/out ディレクトリに出力されます。

gh actions-importer audit --output-dir /data/out

プロキシの使用

HTTP プロキシが構成されたサーバーにアクセスするには、プロキシの URL で以下の環境変数を設定する必要があります。

  •         `OCTOKIT_PROXY`: すべての GitHub サーバーの場合。
    
  •         `HTTP_PROXY` (または `HTTPS_PROXY`): 他のサーバーの場合。
    

次に例を示します。

export OCTOKIT_PROXY=https://proxy.example.com:8443
export HTTPS_PROXY=$OCTOKIT_PROXY

プロキシで認証が必要な場合は、プロキシの URL にユーザー名とパスワードを含める必要があります。 たとえば、「 https://username:password@proxy.url:port 」のように入力します。

SSL 証明書の検証の無効化

既定では、GitHub Actions Importer はネットワーク要求を行うときに SSL 証明書を検証します。 --no-ssl-verify オプションで SSL 証明書の検証を無効にできます。 次に例を示します。

gh actions-importer audit --output-dir ./output --no-ssl-verify

データ再利用可能アクション.actions-importer-legal-notice %}