From 6b3c17d8c057e6e413482932203b23294141740f Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Fri, 23 Apr 2021 04:14:04 +0300 Subject: [PATCH] Add article about customizing GitHub Hosted runners (#18761) * add /actions/guides/customizing-github-hosted-runners * fix linters * fix comments * Update customizing-the-github-hosted-runners.md * customizing-the-github-hosted-runners * Update about-github-hosted-runners.md * Added content design updates * Added misc edits * Update customizing-the-github-hosted-runners.md * Small edits to intro * omit the from title * Update customizing-github-hosted-runners.md * Apply suggestions from code review Co-authored-by: Sarah Edwards * Update customizing-github-hosted-runners.md Co-authored-by: Martin Lopes Co-authored-by: skedwards88 --- ...grating-from-circleci-to-github-actions.md | 4 +- .../about-github-hosted-runners.md | 4 + .../customizing-github-hosted-runners.md | 92 +++++++++++++++++++ .../using-github-hosted-runners/index.md | 1 + ...ng-a-new-ssh-key-to-your-github-account.md | 1 + 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 content/actions/using-github-hosted-runners/customizing-github-hosted-runners.md diff --git a/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md index cbb113098844..f32c255333ba 100644 --- a/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md @@ -443,7 +443,9 @@ jobs: path: vendor/bundle key: administrate-${{ matrix.image }}-${{ hashFiles('Gemfile.lock') }} - name: Install postgres headers - run: sudo apt-get install libpq-dev + run: | + sudo apt-get update + sudo apt-get install libpq-dev - name: Install dependencies run: bundle install --path vendor/bundle - name: Setup environment configuration diff --git a/content/actions/using-github-hosted-runners/about-github-hosted-runners.md b/content/actions/using-github-hosted-runners/about-github-hosted-runners.md index e31cad845da0..6eb8734b54c5 100644 --- a/content/actions/using-github-hosted-runners/about-github-hosted-runners.md +++ b/content/actions/using-github-hosted-runners/about-github-hosted-runners.md @@ -93,6 +93,10 @@ We recommend using actions to interact with the software installed on runners. T If there is a tool that you'd like to request, please open an issue at [actions/virtual-environments](https://github.com/actions/virtual-environments). This repository also contains announcements about all major software updates on runners. +#### Installing additional software + +You can install additional software on {% data variables.product.prodname_dotcom %}-hosted runners. For more information, see "[Customizing GitHub-hosted runners](/actions/using-github-hosted-runners/customizing-github-hosted-runners)". + ### IP addresses {% note %} diff --git a/content/actions/using-github-hosted-runners/customizing-github-hosted-runners.md b/content/actions/using-github-hosted-runners/customizing-github-hosted-runners.md new file mode 100644 index 000000000000..789f759f891d --- /dev/null +++ b/content/actions/using-github-hosted-runners/customizing-github-hosted-runners.md @@ -0,0 +1,92 @@ +--- +title: Customizing GitHub-hosted runners +intro: >- + You can install additional software on GitHub-hosted runners as a + part of your workflow. +product: '{% data reusables.gated-features.actions %}' +versions: + free-pro-team: '*' + enterprise-server: '>=2.22' +type: tutorial +topics: + - Workflows +--- + +{% data reusables.actions.enterprise-github-hosted-runners %} + +If you require additional software packages on {% data variables.product.prodname_dotcom %}-hosted runners, you can create a job that installs the packages as part of your workflow. + +To see which packages are already installed by default, see "[Preinstalled software](/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software)." + +This guide demonstrates how to create a job that installs additional software on a {% data variables.product.prodname_dotcom %}-hosted runner. + +### Installing software on Ubuntu runners + +The following example demonstrates how to install an `apt` package as part of a job. + +{% raw %} +```yaml +name: Build on Ubuntu +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + - name: Install jq tool + run: | + sudo apt-get update + sudo apt-get install jq +``` +{% endraw %} + +{% note %} + +**Note:** Always run `sudo apt-get update` before installing a package. In case the `apt` index is stale, this command fetches and re-indexes any available packages, which helps prevent package installation failures. + +{% endnote %} + +### Installing software on macOS runners + +The following example demonstrates how to install Brew packages and casks as part of a job. + +{% raw %} +```yaml +name: Build on macOS +on: push + +jobs: + build: + runs-on: macos-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + - name: Install GitHub CLI + run: | + brew update + brew install gh + - name: Install Microsoft Edge + run: | + brew update + brew install --cask microsoft-edge +``` +{% endraw %} + +### Installing software on Windows runners + +The following example demonstrates how to use [Chocolatey](https://community.chocolatey.org/packages) to install the {% data variables.product.prodname_dotcom %} CLI as part of a job. + +{% raw %} +```yaml +name: Build on Windows +on: push +jobs: + build: + runs-on: windows-latest + steps: + - run: choco install gh + - run: gh version +``` +{% endraw %} diff --git a/content/actions/using-github-hosted-runners/index.md b/content/actions/using-github-hosted-runners/index.md index 681269a25393..fb91ee9e6418 100644 --- a/content/actions/using-github-hosted-runners/index.md +++ b/content/actions/using-github-hosted-runners/index.md @@ -11,6 +11,7 @@ versions: {% data reusables.actions.enterprise-github-hosted-runners %} {% link_in_list /about-github-hosted-runners %} +{% link_in_list /customizing-github-hosted-runners %} {% link_in_list /about-ae-hosted-runners %} {% link_in_list /adding-ae-hosted-runners %} {% link_in_list /using-ae-hosted-runners-in-a-workflow %} diff --git a/content/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account.md b/content/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account.md index 23fb2d23e715..7a1376f8f781 100644 --- a/content/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account.md +++ b/content/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account.md @@ -87,6 +87,7 @@ After adding a new SSH key to your {% data variables.product.product_name %} acc If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace. ```shell + $ sudo apt-get update $ sudo apt-get install xclip # Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)