~bigbes/tarantool

tarantool-protobuf

ref: afbbf143a7da90873ddcc53abaf6f424023c0705 tarantool-protobuf/.builds/conformance-image-rebuild.yml -rw-r--r-- 2.3 KiB
afbbf143 — Eugene Blikh ci: conformance suite with Garage S3 image cache (7lf) 2 months ago
                                                                                
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Force-rebuild the conformance Docker image and upload it to S3 under the
# current Dockerfile-content hash. Use when the cached image needs refresh
# without a Dockerfile change (base-image CVE pickup, host docker upgrade,
# corrupted upload). Auto-submit is disabled — invoke manually:
#
#   hut --instance srht.bigb.es builds submit .builds/conformance-image-rebuild.yml
#
# Normal CI uses .builds/conformance.yml, which lazy-fills the same S3 key
# on the first push after a Dockerfile change.
image: ubuntu/noble
packages:
  - curl
  - ca-certificates
  - docker.io
  - awscli
  - zstd
secrets:
  - a42011da-a362-40da-9db6-1bf1f9be8be3   # ~/.s3-cache-key-id
  - c0cf5f2d-5d63-4d50-a324-5eaecaa992dd   # ~/.s3-cache-key-secret
sources:
  - https://git.srht.bigb.es/~bigbes/tarantool-protobuf
environment:
  AWS_DEFAULT_REGION: garage
  AWS_ENDPOINT_URL: https://s3.bigb.es
  S3_BUCKET: docker-cache
  S3_PREFIX: tarantool-protobuf/conformance-images
submitter:
  git.sr.ht:
    enabled: false
    allow-refs: []
tasks:
  - aws_credentials: |
      mkdir -p ~/.aws
      cat > ~/.aws/config <<EOF
      [default]
      region = $AWS_DEFAULT_REGION
      s3 =
          addressing_style = path
          signature_version = s3v4
      EOF
      set +x
      export AWS_ACCESS_KEY_ID=$(cat ~/.s3-cache-key-id)
      export AWS_SECRET_ACCESS_KEY=$(cat ~/.s3-cache-key-secret)
      {
        printf 'export AWS_ACCESS_KEY_ID=%q\n'     "$AWS_ACCESS_KEY_ID"
        printf 'export AWS_SECRET_ACCESS_KEY=%q\n' "$AWS_SECRET_ACCESS_KEY"
      } >> ~/.buildenv
      set -x
  - docker_start: |
      sudo systemctl start docker
      sudo usermod -aG docker build
      sudo chmod 666 /var/run/docker.sock
      docker version
  - rebuild: |
      cd tarantool-protobuf
      HASH=$(sha256sum docker/conformance.Dockerfile | cut -c1-16)
      OBJECT_KEY="$S3_PREFIX/$HASH.tar.zst"
      S3_URI="s3://$S3_BUCKET/$OBJECT_KEY"
      echo "Image hash: $HASH"
      echo "S3 URI:     $S3_URI"
      docker build --no-cache --pull \
        -t tarantool-protobuf-conformance:latest \
        -f docker/conformance.Dockerfile docker/
      docker save tarantool-protobuf-conformance:latest \
        | zstd -T0 -3 \
        | aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp - "$S3_URI"
      aws --endpoint-url="$AWS_ENDPOINT_URL" s3api head-object \
        --bucket "$S3_BUCKET" --key "$OBJECT_KEY"