mirror of
https://github.com/RWejlgaard/pez-infra.git
synced 2026-10-31 19:11:03 +00:00
Daily midday fleet deploy (#149)
* Run the fleet deploy every day at midday Adds a schedule trigger to deploy-on-merge so deploy.yml also runs daily at 11:00 UTC (noon London time in BST). It shares the existing concurrency group, so it queues behind a merge deploy instead of overlapping it. * also do terraform
This commit is contained in:
parent
9de6d8faf9
commit
b70a3fb244
3 changed files with 18 additions and 3 deletions
4
.github/workflows/deploy-on-merge.yml
vendored
4
.github/workflows/deploy-on-merge.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Deploy (on merge)
|
name: Deploy (on merge + daily)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -9,6 +9,8 @@ on:
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "**/*.md"
|
- "**/*.md"
|
||||||
- ".github/**"
|
- ".github/**"
|
||||||
|
schedule:
|
||||||
|
- cron: "0 11 * * *"
|
||||||
|
|
||||||
# Serialize fleet deploys so two quick merges can't run Ansible against the
|
# Serialize fleet deploys so two quick merges can't run Ansible against the
|
||||||
# same hosts at once. Don't cancel an in-flight deploy mid-run — queue it.
|
# same hosts at once. Don't cancel an in-flight deploy mid-run — queue it.
|
||||||
|
|
|
||||||
6
.github/workflows/terraform.yml
vendored
6
.github/workflows/terraform.yml
vendored
|
|
@ -6,6 +6,8 @@ on:
|
||||||
paths:
|
paths:
|
||||||
- "terraform/**"
|
- "terraform/**"
|
||||||
- ".github/workflows/terraform.yml"
|
- ".github/workflows/terraform.yml"
|
||||||
|
schedule:
|
||||||
|
- cron: "0 11 * * *"
|
||||||
|
|
||||||
# Requires these repository secrets:
|
# Requires these repository secrets:
|
||||||
# AGE_SECRET_KEY — age private key for SOPS decryption
|
# AGE_SECRET_KEY — age private key for SOPS decryption
|
||||||
|
|
@ -43,7 +45,7 @@ jobs:
|
||||||
run: tofu plan -out=tfplan
|
run: tofu plan -out=tfplan
|
||||||
|
|
||||||
- name: Upload plan
|
- name: Upload plan
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main'
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: tfplan
|
name: tfplan
|
||||||
|
|
@ -53,7 +55,7 @@ jobs:
|
||||||
apply:
|
apply:
|
||||||
name: Apply
|
name: Apply
|
||||||
needs: plan
|
needs: plan
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: production
|
environment: production
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,17 @@ make deploy
|
||||||
make deploy-host HOST=helsinki-a
|
make deploy-host HOST=helsinki-a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## CI deploys
|
||||||
|
|
||||||
|
`.github/workflows/deploy-on-merge.yml` runs `deploy.yml` over the whole fleet:
|
||||||
|
|
||||||
|
- on every merge to `main` (except terraform/docs/workflow-only changes)
|
||||||
|
- every day at 11:00 UTC (midday London time during BST), to pull hosts back in line with the repo
|
||||||
|
|
||||||
|
Ad-hoc runs against a single host or playbook go through the manual `deploy.yml` workflow.
|
||||||
|
|
||||||
|
`.github/workflows/terraform.yml` runs plan + apply on the same daily schedule, as well as on merges touching `terraform/`.
|
||||||
|
|
||||||
## Playbooks
|
## Playbooks
|
||||||
|
|
||||||
| Playbook | Purpose | Usage |
|
| Playbook | Purpose | Usage |
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue