mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Bumps [iFaxity/wait-on-action](https://github.com/ifaxity/wait-on-action) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/ifaxity/wait-on-action/releases)
- [Changelog](https://github.com/iFaxity/wait-on-action/blob/next/release.config.js)
- [Commits](df89d0cf80...a7d13170ec)
---
updated-dependencies:
- dependency-name: iFaxity/wait-on-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
86 lines
3.4 KiB
YAML
86 lines
3.4 KiB
YAML
name: Create ARM node (REUSABLE)
|
|
|
|
on:
|
|
workflow_call:
|
|
outputs:
|
|
id:
|
|
description: "ARM ID"
|
|
value: ${{ jobs.build.outputs.id }}
|
|
ip:
|
|
description: "ARM IP"
|
|
value: ${{ jobs.build.outputs.ip }}
|
|
|
|
secrets:
|
|
SCW_ACCESS_KEY:
|
|
required: true
|
|
SCW_SECRET_KEY:
|
|
required: true
|
|
SCW_DEFAULT_PROJECT_ID:
|
|
required: true
|
|
SCW_DEFAULT_ORGANIZATION_ID:
|
|
required: true
|
|
ARM_SSH_KEY:
|
|
required: true
|
|
ARM_SSH_CONFIG:
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
id: ${{ steps.getinfo.outputs.id }}
|
|
ip: ${{ steps.getinfo.outputs.ip }}
|
|
steps:
|
|
# Prepare
|
|
- name: Checkout source code
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
|
- name: Get ARM availabilities
|
|
id: availabilities
|
|
uses: scaleway/action-scw@be2696f261325a78354eda14988c80405f33e082
|
|
with:
|
|
args: instance server-type get zone=fr-par-2
|
|
export-config: true
|
|
access-key: ${{ secrets.SCW_ACCESS_KEY }}
|
|
secret-key: ${{ secrets.SCW_SECRET_KEY }}
|
|
default-project-id: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
|
|
default-organization-id: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
|
|
- name: Extract ARM type
|
|
run: |
|
|
TYPE=$(echo "$JSON" | jq '.servers | with_entries(select(.key | contains("COPARM1-"))) | with_entries(select(.value.availability != "shortage")) | keys[] | select(. | test("^COPARM1-[0-9]+C-[0-9]+G$"))' | sed 's/"//g' | cut -d '-' -f 2,3 | sort -g | tail -n 1 | xargs -I {} echo "COPARM1-{}")
|
|
echo "Type is $TYPE"
|
|
echo "TYPE=$TYPE" >> "$GITHUB_ENV"
|
|
env:
|
|
JSON: ${{ steps.availabilities.outputs.json }}
|
|
- name: Create ARM VM
|
|
id: scw
|
|
uses: scaleway/action-scw@be2696f261325a78354eda14988c80405f33e082
|
|
with:
|
|
args: instance server create zone=fr-par-2 type=${{ env.TYPE }} root-volume=block:50GB
|
|
- name: Get info
|
|
id: getinfo
|
|
run: |
|
|
echo "id=${{ fromJson(steps.scw.outputs.json).id }}" >> "$GITHUB_OUTPUT"
|
|
echo "ip=${{ fromJson(steps.scw.outputs.json).public_ip.address }}" >> "$GITHUB_OUTPUT"
|
|
- name: Wait for VM
|
|
uses: scaleway/action-scw@be2696f261325a78354eda14988c80405f33e082
|
|
with:
|
|
args: instance server wait ${{ fromJson(steps.scw.outputs.json).ID }} zone=fr-par-2
|
|
- name: Wait for SSH
|
|
uses: iFaxity/wait-on-action@a7d13170ec542bdca4ef8ac4b15e9c6aa00a6866
|
|
with:
|
|
resource: tcp:${{ fromJson(steps.scw.outputs.json).public_ip.address }}:22
|
|
timeout: 300000
|
|
- name: Setup SSH for ARM node
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_KEY" > ~/.ssh/id_rsa_arm
|
|
chmod 600 ~/.ssh/id_rsa_arm
|
|
echo "$SSH_CONFIG" | sed "s/SSH_IP/$SSH_IP/g" > ~/.ssh/config
|
|
env:
|
|
SSH_KEY: ${{ secrets.ARM_SSH_KEY }}
|
|
SSH_IP: ${{ fromJson(steps.scw.outputs.json).public_ip.address }}
|
|
SSH_CONFIG: ${{ secrets.ARM_SSH_CONFIG }}
|
|
- name: Install Docker
|
|
run: ssh root@$SSH_IP "curl -fsSL https://test.docker.com -o test-docker.sh ; sh test-docker.sh ; echo 'ClientAliveInterval 60' >> /etc/ssh/sshd_config ; echo 'ClientAliveCountMax 0' >> /etc/ssh/sshd_config ; systemctl restart ssh"
|
|
env:
|
|
SSH_IP: ${{ fromJson(steps.scw.outputs.json).public_ip.address }}
|