-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitlab-ci.yml
More file actions
53 lines (47 loc) · 1.26 KB
/
Copy pathgitlab-ci.yml
File metadata and controls
53 lines (47 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
variables:
GO_VERSION: "1.21"
AWS_DEFAULT_REGION: "${AWS_REGION}"
# Daily AMI Migrations at 2 AM UTC
.daily-schedule: &daily-schedule
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_SCHEDULE == "daily-migrations"
when: always
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
stages:
- test
- migrate
test:
stage: test
image: golang:${GO_VERSION}
script:
- go test -v ./...
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
migrate:
stage: migrate
image: golang:${GO_VERSION}
script:
- go build -o ami-migrate
- ./ami-migrate migrate
<<: *daily-schedule
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_REGION: ${AWS_REGION}
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Schedule configuration
schedules:
- name: "daily-migrations"
cron: "0 2 * * *"
description: "Run AMI migrations daily at 2 AM UTC"
active: true
ref: main