mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
commit
9a748a5a55
9
.github/workflows/branchtest.yml
vendored
9
.github/workflows/branchtest.yml
vendored
|
@ -2,6 +2,11 @@ name: Deploy and Test Branch
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branches:
|
||||||
|
description: 'Branch to deploy and test'
|
||||||
|
required: true
|
||||||
|
default: 'develop'
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
branches: [develop]
|
branches: [develop]
|
||||||
|
@ -28,7 +33,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: gravitl/netclient
|
repository: gravitl/netclient
|
||||||
ref: develop
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || 'develop' }}
|
||||||
- name: check if branch exists
|
- name: check if branch exists
|
||||||
id: getbranch
|
id: getbranch
|
||||||
run: |
|
run: |
|
||||||
|
@ -45,6 +50,6 @@ jobs:
|
||||||
needs: [getbranch, skip-check]
|
needs: [getbranch, skip-check]
|
||||||
with:
|
with:
|
||||||
netclientbranch: ${{ needs.getbranch.outputs.netclientbranch }}
|
netclientbranch: ${{ needs.getbranch.outputs.netclientbranch }}
|
||||||
netmakerbranch: ${{ github.head_ref }}
|
netmakerbranch: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.head_ref }}
|
||||||
tag: ${{ github.run_id }}-${{ github.run_attempt }}
|
tag: ${{ github.run_id }}-${{ github.run_attempt }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
28
.github/workflows/deletedroplets.yml
vendored
28
.github/workflows/deletedroplets.yml
vendored
|
@ -37,7 +37,7 @@ jobs:
|
||||||
- name: delete droplets
|
- name: delete droplets
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
run: |
|
run: |
|
||||||
sleep 5m
|
sleep 1m
|
||||||
response=$(curl -X DELETE \
|
response=$(curl -X DELETE \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||||
|
@ -56,8 +56,9 @@ jobs:
|
||||||
echo "Failed to delete droplets. Status code: $status_code"
|
echo "Failed to delete droplets. Status code: $status_code"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
sleep 1m
|
||||||
env:
|
env:
|
||||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
DIGITALOCEAN_TOKEN: ${{ secrets.DO_TEST_TOKEN }}
|
||||||
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
||||||
- name: mark server as available
|
- name: mark server as available
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
|
@ -108,13 +109,28 @@ jobs:
|
||||||
- name: delete droplets
|
- name: delete droplets
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
run: |
|
run: |
|
||||||
sleep 3h
|
sleep 1m
|
||||||
curl -X DELETE \
|
response=$(curl -X DELETE \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||||
"https://api.digitalocean.com/v2/droplets?tag_name=$TAG"
|
-w "\n%{http_code}" \
|
||||||
|
"https://api.digitalocean.com/v2/droplets?tag_name=$TAG")
|
||||||
|
|
||||||
|
status_code=$(echo "$response" | tail -n1)
|
||||||
|
body=$(echo "$response" | sed '$d')
|
||||||
|
|
||||||
|
echo "Response body: $body"
|
||||||
|
echo "Status code: $status_code"
|
||||||
|
|
||||||
|
if [ "$status_code" -eq 204 ]; then
|
||||||
|
echo "Droplets deleted successfully"
|
||||||
|
else
|
||||||
|
echo "Failed to delete droplets. Status code: $status_code"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1m
|
||||||
env:
|
env:
|
||||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
DIGITALOCEAN_TOKEN: ${{ secrets.DO_TEST_TOKEN }}
|
||||||
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
||||||
- name: mark server as available
|
- name: mark server as available
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
|
|
|
@ -18,7 +18,7 @@ var htmlBaseTemplate = `<!DOCTYPE html>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function redirect()
|
function redirect()
|
||||||
{
|
{
|
||||||
window.location.href="` + servercfg.GetFrontendURL() + `";
|
window.location.href="` + fmt.Sprintf("https://dashboard.%s/login", servercfg.GetNmBaseDomain()) + `";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in a new issue