Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify reset CI parameters #1618

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/actions/lotus-ansible-reset/action.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: "Lotus Ansible Reset"
description: "Composite action to reset Lotus using Ansible"
inputs:
install_network:
description: "Install network"
required: true
deploy_network:
description: "Deploy network"
network:
description: "The network to reset, one of 'butterflynet', or 'calibnet' "
required: true
preseal:
description: "Preseal"
Expand All @@ -28,14 +25,14 @@ inputs:
required: false
default: "0"
check:
description: "Check"
description: "Dry-run ansible"
required: false
default: "true"

runs:
using: "composite"
steps:
- name: Check Env
- name: Check environment
shell: bash
run: |
if [ -z "$GOPATH" ]; then
Expand All @@ -46,24 +43,32 @@ runs:
echo "::error::LOTUSROOT is not set"
exit 1
fi

- name: Setup environment variables
shell: bash
run: |
# Infer deploy network from network name to reduce unnecessary noise in actions inputs.
DEPLOY_NETWORK=$(
case ${{ inputs.network }} in
butterflynet) printf 'butterfly.fildev.network' ;;
calibnet) printf 'calibration.fildev.network' ;;
*) echo 'Unknown network: ${{ env.NETWORK }}' >&2; exit 1 ;;
esac
)
echo "DEPLOY_NETWORK=${DEPLOY_NETWORK}" >> $GITHUB_ENV
- name: Install Lotus Software
shell: bash
working-directory: ${{ env.LOTUSROOT }}
env:
INSTALL_NETWORK: ${{ inputs.install_network }}
run: |
sudo apt-get update
sudo apt-get install -y libhwloc-dev ocl-icd-opencl-dev pkg-config
sudo ln -s /usr/lib/x86_64-linux-gnu/libhwloc.so.15 /usr/lib/x86_64-linux-gnu/libhwloc.so.5
GOFLAGS+=-tags=${INSTALL_NETWORK} make lotus-shed lotus-seed
GOFLAGS+=-tags=${{ inputs.network }} make lotus-shed lotus-seed
sudo install -o root -g root -m 0755 ./lotus-seed ./lotus-shed /usr/local/bin

- name: Ansible Reset ${{ inputs.deploy_network }}
- name: Ansible Reset ${{ inputs.network }}
shell: bash
working-directory: ansible
env:
DEPLOY_NETWORK: ${{ inputs.deploy_network }}
BUILD_FLAGS: ${{ inputs.build_flags }}
DELAY: ${{ inputs.delay }}
RESET: ${{ inputs.reset }}
Expand All @@ -90,17 +95,13 @@ runs:
if: ${{ inputs.check == 'false' }}
shell: bash
working-directory: ansible
env:
DEPLOY_NETWORK: ${{ inputs.deploy_network }}
run: |
ansible -i inventories/${DEPLOY_NETWORK}/hosts.yml -b -m file -a 'state=link src=/etc/nginx/sites-available/faucet.conf dest=/etc/nginx/sites-enabled/50-faucet.conf' faucet

- name: Restart Machines
if: ${{ inputs.check == 'false' }}
shell: bash
working-directory: ansible
env:
DEPLOY_NETWORK: ${{ inputs.deploy_network }}
run: |
ansible -i inventories/${DEPLOY_NETWORK}/hosts.yml -b -m reboot all

Expand Down
37 changes: 16 additions & 21 deletions .github/workflows/lotus-ansible-reset.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
name: Lotus Ansible Reset Careful

# api_worflow_requested = lotus-devnet-ansible-reset
# and be_careful = true

on:
workflow_dispatch:
inputs:
lotus_install_network:
description: "network to build lotus tools"
network:
description: "Network:"
default: "butterflynet"
lotus_deploy_network:
description: "network to find ansible host"
default: "butterfly.fildev.network"
lotus_branch:
description: "lotus branch"
type: choice
options:
- butterflynet
- calibnet
lotus_ref:
description: "Lotus git ref:"
default: "master"
dry-run:
description: "Run this workflow in dry-run mode first befure setting to false"
default: "true"
# if we ever switch to Github Enterprise or make this repository public,
# we can use an environment with required reviewers.
# then run two steps: one with check: true, and the other with check: false and the required env.
description: "Dry-run changes?"
type: boolean
default: true

jobs:
check:
runs-on: [self-hosted, linux, x64, 2xlarge]
runs-on: [ self-hosted, linux, x64, 2xlarge ]
timeout-minutes: 35
steps:
- name: Checkout code
Expand All @@ -33,22 +29,21 @@ jobs:
- name: Lotus Ansible Prepare
uses: ./.github/actions/lotus-ansible-prepare
with:
branch: ${{ github.event.inputs.lotus_branch || 'master' }}
branch: ${{ inputs.lotus_ref }}
EC2_SSH_KEY: ${{ secrets.EC2_SSH_KEY }}
PRIVATE_SSH_KEY: ${{ secrets.PRIVATE_SSH_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-2"
AWS_REGION: "us-east-1"
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}

- name: Lotus Ansible Reset
uses: ./.github/actions/lotus-ansible-reset
with:
deploy_network: ${{ github.event.inputs.lotus_deploy_network || 'butterfly.fildev.network' }}
install_network: ${{ github.event.inputs.lotus_install_network || 'butterflynet' }}
network: ${{ inputs.network }}
preseal: "true"
create_cert: "true"
build_flags: ""
reset: "true"
delay: "0"
check: ${{ github.event.inputs.dry-run || 'true' }}
check: ${{ inputs.dry-run || 'true' }}
Loading