54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
name: OrchestratorCI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
spec:
|
|
required: true
|
|
type: string
|
|
runner_id:
|
|
required: true
|
|
type: string
|
|
|
|
secrets:
|
|
DO_TOKEN:
|
|
required: true
|
|
SSH_PRIVATE_KEY_DECODED:
|
|
required: true
|
|
|
|
outputs:
|
|
ready:
|
|
description: "The result of the orchestrator job"
|
|
value: ${{ jobs.provisioning.outputs.ready }} # Gunakan jobs
|
|
droplet_id:
|
|
description: "The ID of the created droplet"
|
|
value: ${{ jobs.provisioning.outputs.droplet_id }}
|
|
droplet_ip:
|
|
description: "The IP address of the created droplet"
|
|
value: ${{ jobs.provisioning.outputs.droplet_ip }}
|
|
|
|
jobs:
|
|
provisioning:
|
|
runs-on: gitea-orchestrator
|
|
name: OrchestratorCI Job
|
|
outputs:
|
|
ready: ${{ steps.provisioning.outputs.ready }} # Sesuaikan nama
|
|
droplet_id: ${{ steps.provisioning.outputs.droplet_id }}
|
|
droplet_ip: ${{ steps.provisioning.outputs.droplet_ip }}
|
|
steps:
|
|
- name: Run OrchestratorCI
|
|
id: provisioning
|
|
env:
|
|
SPEC: ${{ inputs.spec }}
|
|
RUNNER_ID: ${{ inputs.runner_id }}
|
|
DO_TOKEN: ${{ secrets.DO_TOKEN }}
|
|
SSH_PRIVATE_KEY_DECODED: ${{ secrets.SSH_PRIVATE_KEY_DECODED }}
|
|
run: |
|
|
wget https://github.com/digitalocean/doctl/releases/download/v1.141.0/doctl-1.141.0-linux-amd64.tar.gz
|
|
tar -xvf doctl-1.141.0-linux-amd64.tar.gz
|
|
mv doctl /usr/local/bin
|
|
|
|
curl https://git.btwazure.com/btwedutech/workflows/raw/branch/main/orchestrator/orchestrating.sh -o /usr/local/bin/orchestrating.sh
|
|
curl https://git.btwazure.com/btwedutech/workflows/raw/branch/main/orchestrator/cleanup.sh -o /usr/local/bin/cleanup.sh
|
|
chmod +x /usr/local/bin/orchestrating.sh /usr/local/bin/cleanup.sh
|
|
orchestrating.sh |