|
5 | 5 | - services/server/**/* |
6 | 6 | - .gitlab/ci/build_server.yml |
7 | 7 | - .gitlab/ci/deploy_server.yml |
8 | | - needs: |
9 | | - - job: server-image |
10 | | - artifacts: false |
11 | | - |
12 | | -variables: |
13 | | - MANIFEST_GIT_REPO: https://gitlab.futo.org/devops/manifest-inventory.git |
14 | | - MANIFEST_GIT_USER_EMAIL: $GITLAB_USER_EMAIL |
15 | | - MANIFEST_GIT_USER_NAME: $GITLAB_USER_NAME |
16 | 8 |
|
17 | | -################################################################# |
18 | | -# Prepare the manifest changes as .patch files so we can review # |
19 | | -################################################################# |
| 9 | +######################################## |
| 10 | +# Tag the image with environment label # |
| 11 | +######################################## |
20 | 12 |
|
21 | | -.server-deploy-prepare: |
| 13 | +.server-deploy-image: |
22 | 14 | extends: .server-deploy-workflow |
23 | 15 | stage: deploy |
24 | 16 | image: |
25 | | - name: alpine/git:latest |
| 17 | + name: gcr.io/go-containerregistry/crane:debug |
26 | 18 | entrypoint: [''] |
27 | | - before_script: |
28 | | - - wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 |
29 | | - - chmod +x /usr/local/bin/yq |
30 | 19 | script: |
31 | | - # Pull in the manifest repository |
32 | | - - git clone "https://gitlab-ci-token:${MANIFEST_GIT_TOKEN}@${MANIFEST_GIT_REPO#https://}" manifest-inventory |
33 | | - - cd manifest-inventory |
34 | | - # Use 'yq' to change the yaml value to the current commit |
35 | | - - yq -i ".image.version.$ENVIRONMENT = strenv(CI_COMMIT_SHA)" inventory/polycentric-2026/server.yml |
36 | | - # Commit the change in the manifest repo |
37 | | - - git config user.email "$MANIFEST_GIT_USER_EMAIL" |
38 | | - - git config user.name "$MANIFEST_GIT_USER_NAME" |
39 | | - - git add inventory/polycentric-2026/server.yml |
40 | | - - 'git commit -m "polycentric-2026 $ENVIRONMENT: bump server to $CI_COMMIT_SHA"' |
41 | | - # Export the commit as a patch artifact |
42 | | - - git format-patch -1 -o "$CI_PROJECT_DIR/deploy-patches/" |
43 | | - # Print the patch in the job log for review |
44 | | - - cat "$CI_PROJECT_DIR/deploy-patches/"*.patch |
45 | | - artifacts: |
46 | | - paths: |
47 | | - - deploy-patches/ |
48 | | - expire_in: 1 week |
| 20 | + - crane auth login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD |
| 21 | + - crane tag $CI_REGISTRY_IMAGE/server:$CI_COMMIT_SHA $ENVIRONMENT |
| 22 | + needs: |
| 23 | + - job: server-image |
| 24 | + artifacts: false |
49 | 25 |
|
50 | | -server-deploy-prepare-staging: |
51 | | - extends: .server-deploy-prepare |
| 26 | +server-deploy-image-staging: |
| 27 | + extends: .server-deploy-image |
52 | 28 | variables: |
53 | 29 | ENVIRONMENT: staging |
54 | 30 |
|
55 | | -server-deploy-prepare-production: |
56 | | - extends: .server-deploy-prepare |
| 31 | +server-deploy-image-production: |
| 32 | + extends: .server-deploy-image |
| 33 | + when: manual |
57 | 34 | variables: |
58 | | - ENVIRONMENT: polycentric |
| 35 | + ENVIRONMENT: production |
59 | 36 |
|
60 | 37 | ############################### |
61 | | -# Deploy the manifest changes # |
| 38 | +# Rolling restart on Manifest # |
62 | 39 | ############################### |
63 | 40 |
|
64 | | -.server-deploy-apply: |
| 41 | +.server-deploy-manifest: |
65 | 42 | extends: .server-deploy-workflow |
66 | 43 | stage: deploy |
67 | | - image: |
68 | | - name: alpine/git:latest |
69 | | - entrypoint: [''] |
70 | | - when: manual |
71 | | - script: |
72 | | - # Pull in the manifest repository |
73 | | - - git clone "https://gitlab-ci-token:${MANIFEST_GIT_TOKEN}@${MANIFEST_GIT_REPO#https://}" manifest-inventory |
74 | | - - cd manifest-inventory |
75 | | - # Show the patch we are about to apply |
76 | | - - cat "$CI_PROJECT_DIR/deploy-patches/"*.patch |
77 | | - # Apply the patch and push it to the manifest repo |
78 | | - - git config user.email "$MANIFEST_GIT_USER_EMAIL" |
79 | | - - git config user.name "$MANIFEST_GIT_USER_NAME" |
80 | | - - git am "$CI_PROJECT_DIR/deploy-patches/"*.patch |
81 | | - - git push origin HEAD |
| 44 | + trigger: |
| 45 | + project: devops/manifest |
| 46 | + branch: master |
| 47 | + strategy: depend |
| 48 | + variables: |
| 49 | + MANIFEST_SETUP_COMMAND: quick |
| 50 | + MANIFEST_QUICK_TARGETS: inventory/polycentric-2026/server.yml:$ENVIRONMENT |
| 51 | + MANIFEST_STAGGER_TIME: '10' |
82 | 52 |
|
83 | | -server-deploy-apply-staging: |
84 | | - extends: .server-deploy-apply |
| 53 | +server-deploy-manifest-staging: |
| 54 | + extends: .server-deploy-manifest |
| 55 | + variables: |
| 56 | + ENVIRONMENT: staging |
85 | 57 | needs: |
86 | | - - job: server-deploy-prepare-staging |
87 | | - artifacts: true |
| 58 | + - server-deploy-image-staging |
88 | 59 |
|
89 | | -server-deploy-apply-production: |
90 | | - extends: .server-deploy-apply |
| 60 | +server-deploy-manifest-production: |
| 61 | + extends: .server-deploy-manifest |
| 62 | + variables: |
| 63 | + ENVIRONMENT: production |
91 | 64 | needs: |
92 | | - - job: server-deploy-prepare-production |
93 | | - artifacts: true |
| 65 | + - server-deploy-image-production |
0 commit comments