Rebuild CI dependencies #671
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rebuild CI dependencies | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 00 * * *' # utc | |
jobs: | |
ci-dependencies: | |
runs-on: [self-hosted, vm] | |
timeout-minutes: 120 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# NOTE(mikal): git repos are checked out to /srv/github/_work/{org}/{repo} | |
# which is available as GITHUB_WORKSPACE. You can find other environment | |
# variables at https://docs.github.com/en/actions/learn-github-actions/environment-variables | |
steps: | |
- name: Set environment variables | |
run: | | |
echo "SHAKENFIST_NAMESPACE=$(hostname)" >> $GITHUB_ENV | |
- name: Checkout the actions repository | |
uses: actions/checkout@v4 | |
with: | |
repository: shakenfist/actions | |
path: actions | |
fetch-depth: 0 | |
- name: Install the github command line | |
run: | | |
sudo apt update | |
sudo apt install -y curl | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | |
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
sudo apt update | |
sudo apt install -y gh | |
- name: Lookup latest version of the GitHub actions runner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
actions_url=$(gh release view --repo actions/runner --json assets | \ | |
jq -r '.assets[].url | select (contains("linux-x64-2")) | select (test("[0-9].tar.gz$"))') | |
echo "GITHUB_ACTIONS_URL=$actions_url" >> $GITHUB_ENV | |
- name: Build dependencies image | |
run: | | |
cd ${GITHUB_WORKSPACE}/actions | |
ansible-playbook -i /home/debian/ansible-hosts \ | |
--extra-vars "identifier=${SHAKENFIST_NAMESPACE} source_path=${GITHUB_WORKSPACE} \ | |
base_image=sf://label/ci-images/debian-11 base_image_user=debian \ | |
label=ci-images/dependencies actions_url=$GITHUB_ACTIONS_URL" \ | |
ansible/ci-dependencies.yml | |
- uses: JasonEtco/create-an-issue@v2 | |
if: failure() | |
id: create-issue | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SF_CI_NAME: ci-dependencies | |
SF_ACTION_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
with: | |
filename: shakenfist/.github/workflows/ci-images-failure.md | |
update_existing: true | |
search_existing: open | |
- if: failure() | |
run: 'echo Created ${{ steps.create-issue.outputs.url }}' |