mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 07:16:06 +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:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branches:
|
||||
description: 'Branch to deploy and test'
|
||||
required: true
|
||||
default: 'develop'
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches: [develop]
|
||||
|
@ -28,7 +33,7 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: gravitl/netclient
|
||||
ref: develop
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || 'develop' }}
|
||||
- name: check if branch exists
|
||||
id: getbranch
|
||||
run: |
|
||||
|
@ -45,6 +50,6 @@ jobs:
|
|||
needs: [getbranch, skip-check]
|
||||
with:
|
||||
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 }}
|
||||
secrets: inherit
|
||||
|
|
28
.github/workflows/deletedroplets.yml
vendored
28
.github/workflows/deletedroplets.yml
vendored
|
@ -37,7 +37,7 @@ jobs:
|
|||
- name: delete droplets
|
||||
if: success() || failure()
|
||||
run: |
|
||||
sleep 5m
|
||||
sleep 1m
|
||||
response=$(curl -X DELETE \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||
|
@ -56,8 +56,9 @@ jobs:
|
|||
echo "Failed to delete droplets. Status code: $status_code"
|
||||
exit 1
|
||||
fi
|
||||
sleep 1m
|
||||
env:
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DO_TEST_TOKEN }}
|
||||
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
||||
- name: mark server as available
|
||||
if: success() || failure()
|
||||
|
@ -108,13 +109,28 @@ jobs:
|
|||
- name: delete droplets
|
||||
if: success() || failure()
|
||||
run: |
|
||||
sleep 3h
|
||||
curl -X DELETE \
|
||||
sleep 1m
|
||||
response=$(curl -X DELETE \
|
||||
-H "Content-Type: application/json" \
|
||||
-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:
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DO_TEST_TOKEN }}
|
||||
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
||||
- name: mark server as available
|
||||
if: success() || failure()
|
||||
|
|
|
@ -18,7 +18,7 @@ var htmlBaseTemplate = `<!DOCTYPE html>
|
|||
<script type="text/javascript">
|
||||
function redirect()
|
||||
{
|
||||
window.location.href="` + servercfg.GetFrontendURL() + `";
|
||||
window.location.href="` + fmt.Sprintf("https://dashboard.%s/login", servercfg.GetNmBaseDomain()) + `";
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
Loading…
Reference in a new issue