This repository has no description
1.buildkit:
2 image:
3 name: moby/buildkit:rootless
4 entrypoint: ["sh", "-c"]
5 variables:
6 BUILDKITD_FLAGS: --oci-worker-no-process-sandbox
7 before_script:
8 - |
9 mkdir -p ~/.docker && cat > ~/.docker/config.json <<EOF
10 {
11 "auths": {
12 "$CI_REGISTRY": {
13 "auth": "$(echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64)"
14 }
15 }
16 }
17 EOF
18
19stages:
20 - update
21 - test
22 - build
23
24test:typescript:
25 image: registry.inpt.fr/inp-net/images/go-just:1.23.5-1.39.0
26 stage: test
27 rules:
28 - when: always
29 before_script:
30 - apk add git npm jq
31 - cp -r typescript typescript_original
32 - just build
33 - just gen_typescript
34 script:
35 - |
36 for file in typescript/*.ts; do
37 if ! diff -q $file typescript_original/$(basename $file); then
38 diff typescript_original/$(basename $file) $file
39 echo "Generated file $file is different from original, please run 'just gen_typescript' and commit the changes"
40 exit 1
41 fi
42 done
43
44test:up-to-date-prisma-schema:
45 image: registry.inpt.fr/inp-net/images/go-just:1.23.5-1.39.0
46 stage: test
47 rules:
48 - when: always
49 before_script:
50 - apk add curl
51 - just updateschema
52 - cp schema.prisma original_schema.prisma
53 script:
54 - |
55 if ! diff -q schema.prisma original_schema.prisma; then
56 echo "Generated schema.prisma is different from original, please run 'just updateschema' and commit the changes"
57 exit 1
58 fi
59
60update:prisma-schema:
61 image: registry.inpt.fr/inp-net/images/go-just:1.23.5-1.39.0
62 stage: update
63 allow_failure: true
64 rules:
65 - if: $CI_PIPELINE_SOURCE == "pipeline"
66 - when: manual
67 before_script:
68 - apk add curl
69 - just updateschema $SCHEMA_RAW_URL
70 - git config --global user.name gitlab
71 - git config --global user.email "git@noreply.inpt.fr"
72 - git remote remove gitlab_origin || true
73 - git remote add gitlab_origin https://bot:$BOT_TOKEN@$CI_SERVER_SHELL_SSH_HOST/$CI_PROJECT_PATH
74 script:
75 - git add schema.prisma
76 - 'git commit -m "chore(prisma): update schema.prisma after churros/churros change"'
77 - git push gitlab_origin HEAD:main
78
79build:
80 extends: .buildkit
81 stage: build
82 rules:
83 - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/
84 variables:
85 DEPLOY: "true"
86 script:
87 - |
88 if [ "$DEPLOY" == "true" ]; then
89 export TAG=$(echo $CI_COMMIT_TAG | sed 's/^v//')
90 else
91 export TAG=latest-$(echo $CI_COMMIT_SHA | cut -c-6)
92 fi
93 - |
94 buildctl-daemonless.sh build \
95 --frontend=dockerfile.v0 \
96 --local context=. \
97 --local dockerfile=. \
98 --opt build-arg:TAG=$TAG \
99 --output type=image,name=$CI_REGISTRY_IMAGE:v$TAG,push=$DEPLOY
100 - |
101 if [ "$DEPLOY" == "true"]; then
102 echo "Successfully built and pushed $CI_REGISTRY_IMAGE:v$TAG"
103 else
104 echo "Successfully built $CI_REGISTRY_IMAGE:v$TAG"
105 fi