About self-hosted runners for GitHub Actions
GitHub Actions allows people who use your GitHub Enterprise Server instance to improve productivity by automating every phase of the software development workflow. For more information, see "About GitHub Actions for enterprises."
With GitHub Actions, developers can write and combine individual tasks called actions to create custom workflows. To enable GitHub Actions for your GitHub Enterprise Server instance, you must host at least one machine to execute jobs. This machine is called a self-hosted runner. Os executores auto-hospedados podem ser físicos, virtuais, em um contêiner, no local ou em uma nuvem. A sua máquina do executor conecta-se ao GitHub Enterprise Server usando o aplicativo do executor auto-hospedado de GitHub Actions. Self-hosted runners can run Linux, Windows, or macOS. For more information, see "About self-hosted runners."
This guide shows you how to apply a centralized management approach to self-hosted runners for GitHub Actions in your enterprise. In the guide, you'll complete the following tasks.
- Configure a limited policy to restrict the actions that can run within your enterprise
- Deploy a self-hosted runner for your enterprise
- Create a group to manage access to the runners available to your enterprise
- Optionally, further restrict the repositories that can use the runner
You'll also find additional information about how to monitor and secure your self-hosted runners, how to access actions from GitHub.com, and how to customize the software on your runner machines.
After you finish the guide, users of your GitHub Enterprise Server instance will be able to run workflow jobs from GitHub Actions on a self-hosted runner machine.
Prerequisites
-
O GitHub Actions precisa ser habilitado para o GitHub Enterprise Server. Um administrador de site pode habilitar e configurar o GitHub Actions para sua instância. Para obter mais informações, confira "Introdução ao GitHub Actions para GitHub Enterprise Server".
-
Você precisa ter acesso ao computador que usará como um executor auto-hospedado no seu ambiente.
-
The connection between self-hosted runners and GitHub Enterprise Server is over HTTP (port 80) or HTTPS (port 443). To ensure connectivity over HTTPS, configure TLS for your GitHub Enterprise Server instance. For more information, see "Configuring TLS." Para obter mais informações, confira "Sobre os executores auto-hospedados".
-
Your enterprise must own at least one organization. For more information, see "About organizations" and "Creating a new organization from scratch."
1. Configure policies for GitHub Actions
First, enable GitHub Actions for all organizations, and configure a policy to restrict the actions that can run on your GitHub Enterprise Server instance. Optionally, organization owners can further restrict these policies for each organization.
-
No canto superior � direita de GitHub Enterprise Server, clique na foto do perfil e clique em Configurações da empresa.
-
Na barra lateral da empresa, clique em Políticas.
-
Em " Políticas", clique em Actions.
-
Under "Policies", select Enable for all organizations.
-
Select Permitir ações selecionadas and Allow actions created by GitHub to allow local actions, and actions created by GitHub.
-
Click Save.
You can configure additional policies to restrict the actions available to users of your GitHub Enterprise Server instance. For more information, see "Enforcing policies for GitHub Actions in your enterprise."
2. Deploy the self-hosted runner for your enterprise
Next, add a self-hosted runner to your enterprise. GitHub Enterprise Server will guide you through installation of the necessary software on the runner machine. After you deploy the runner, you can verify connectivity between the runner machine and your GitHub Enterprise Server instance.
Adding the self-hosted runner
To add a self-hosted runner to an enterprise, you must be an enterprise owner.
-
No canto superior � direita de GitHub Enterprise Server, clique na foto do perfil e clique em Configurações da empresa.
-
Na barra lateral da empresa, clique em Políticas.
-
Em " Políticas", clique em Actions.
-
Clique na guia Executores.
-
Click Add new, then click New runner.
-
Selecione a imagem e a arquitetura do sistema operacional do computador do executor auto-hospedado.
-
Você verá instruções mostrando como baixar o executor e instalá-lo em sua máquina de executor auto-hospedada.
Abra um shell em sua máquina de executor auto-hospedado e execute cada comando shell na ordem mostrada.
Observação: no Windows, caso você deseje instalar o aplicativo do executor auto-hospedado como um serviço, abra um shell com privilégios de administrador. Também recomendamos que você use
C:\actions-runner
como diretório para o aplicativo do executor auto-hospedado para que as contas do sistema do Windows possam acessar o diretório do executor.As instruções te ajudam a completar estas tarefas:
- Transferindo e extraindo o aplicativo do executor auto-hospedado.
- Executar o script
config
para configurar o aplicativo do executor auto-hospedado e registrá-lo no GitHub Actions. O scriptconfig
exige a URL de destino e um token de tempo limitado gerado automaticamente para autenticar a solicitação.- No Windows, o script
config
também pergunta se você deseja instalar o aplicativo do executor auto-hospedado como um serviço. Para Linux e macOS, você pode instalar um serviço depois de terminar de adicionar o executor. Para obter mais informações, confira "Como configurar o aplicativo do executor auto-hospedado como um serviço".
- No Windows, o script
- Executando o aplicativo do executor auto-hospedado para conectar a máquina ao GitHub Actions.
Verificando se o seu executor auto-hospedado foi adicionado com sucesso
Depois de completar as etapas para adicionar um executor auto-hospedado, o executor e seu status serão listados em "Executores auto-hospedados".
A aplicação dos executores auto-hospedados deve estar activa para que o executor aceite os trabalhos. Quando o aplicativo do executor estiver conectado a GitHub Enterprise Server e pronto para receber trabalhos, você verá a seguinte mensagem no terminal da máquina.
√ Connected to GitHub
2019-10-24 05:45:56Z: Listening for Jobs
3. Manage access to the self-hosted runner using a group
You can create a runner group to manage access to the runner that you added to your enterprise. You'll use the group to choose which organizations can execute jobs from GitHub Actions on the runner.
GitHub Enterprise Server adds all new runners to a group. Runners can be in one group at a time. By default, GitHub Enterprise Server adds new runners to the "Default" group.
-
No canto superior � direita de GitHub Enterprise Server, clique na foto do perfil e clique em Configurações da empresa.
-
Na barra lateral da empresa, clique em Políticas.
-
Em " Políticas", clique em Actions.
-
Clique na guia Executores.
-
Use the Add new drop-down, and select New group.
-
Under "Group name", type a name for your runner group.
-
To choose a policy for organization access, under "Organization access", select the Organization access drop-down, and click Selected organizations.
-
To the right of the drop-down with the organization access policy, click .
-
Select the organizations you'd like to grant access to the runner group.
-
Optionally, to allow public repositories in the selected organizations to use runners in the group, select Allow public repositories.
Warning:
Recomendamos que você use apenas executores auto-hospedados com repositórios privados. Isso acontece porque as bifurcações do seu repositório podem potencialmente executar código perigoso na sua máquina de executor auto-hospedada criando um pull request que executa o código em um fluxo de trabalho.
For more information, see "About self-hosted runners."
-
Click Save group to create the group and apply the policy.
-
To the right of "Default", click the number of runners in the group to show the runners.
-
Select the runner that you deployed.
-
To the right of "Runner groups", select the Move to group dropdown, and click the group that you previously created.
You've now deployed a self-hosted runner that can run jobs from GitHub Actions within the organizations that you specified.
4. Further restrict access to the self-hosted runner
Optionally, organization owners can further restrict the access policy of the runner group that you created. For example, an organization owner could allow only certain repositories in the organization to use the runner group.
For more information, see "Managing access to self-hosted runners using groups."
Next steps
-
You can monitor self-hosted runners and troubleshoot common issues. For more information, see "Monitoring and troubleshooting self-hosted runners."
-
GitHub recommends that you review security considerations for self-hosted runner machines. For more information, see "Security hardening for GitHub Actions."
-
You can manually sync repositories on GitHub.com containing actions to your enterprise on GitHub Enterprise Server. Alternatively, you can allow members of your enterprise to automatically access actions from GitHub.com by using GitHub Connect. For more information, see the following.
-
You can customize the software available on your self-hosted runner machines, or configure your runners to run software similar to GitHub-hosted runners available for customers using GitHub.com. The software that powers runner machines for GitHub Actions is open source. For more information, see the
actions/runner
andactions/runner-images
repositories.