diff --git a/.builds/c-enabled.yml b/.builds/c-enabled.yml index b314a022cbdf4e6f1294f3fd698f197ff0e348c2..6f03b0564c3a1103959b6566f59e667367981034 100644 --- a/.builds/c-enabled.yml +++ b/.builds/c-enabled.yml @@ -6,6 +6,10 @@ - gnupg - protobuf-compiler - cmake - build-essential + - unzip +secrets: + - 7dde4219-0783-4581-a67d-c94749de3600 # ~/.s3-cache-key-id + - 0e5b3530-6f19-4f30-9b73-9339dd382e46 # ~/.s3-cache-key-secret sources: - https://git.srht.bigb.es/~bigbes/tarantool-protobuf environment: @@ -14,6 +18,9 @@ GOROOT: /home/build/.local/go GO_VERSION: "1.26.3" PATH: /home/build/.local/go/bin:/home/build/.local/bin:/home/build/go/bin:/usr/local/bin:/usr/bin:/bin PB_ENABLE_C: "1" + AWS_DEFAULT_REGION: garage + AWS_ENDPOINT_URL: https://s3.bigb.es + S3_BUCKET: docker-cache submitter: git.sr.ht: enabled: true @@ -21,10 +28,50 @@ allow-refs: - refs/heads/master - "refs/tags/*" tasks: + - install_awscli: | + curl -sSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" \ + -o /tmp/awscliv2.zip + unzip -q /tmp/awscliv2.zip -d /tmp + sudo /tmp/aws/install + aws --version + - aws_credentials: | + mkdir -p ~/.aws + cat > ~/.aws/config <> ~/.buildenv + echo 'export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required' >> ~/.buildenv + set +x + export AWS_ACCESS_KEY_ID=$(tr -d '[:space:]' < ~/.s3-cache-key-id) + export AWS_SECRET_ACCESS_KEY=$(tr -d '[:space:]' < ~/.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 + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 ls "s3://$S3_BUCKET/" >/dev/null - install_go: | + GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz" + GO_KEY="golang/$GO_TARBALL" + GO_URI="s3://$S3_BUCKET/$GO_KEY" mkdir -p ~/.local - curl -sSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \ - | tar -xz -C ~/.local + if aws --endpoint-url="$AWS_ENDPOINT_URL" s3api head-object \ + --bucket "$S3_BUCKET" --key "$GO_KEY" >/dev/null 2>&1; then + echo "Cache HIT — pulling Go from S3" + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp "$GO_URI" - \ + | tar -xz -C ~/.local + else + echo "Cache MISS — downloading from go.dev and caching" + curl -sSL --retry 3 --retry-delay 5 --max-time 300 \ + "https://go.dev/dl/$GO_TARBALL" -o "/tmp/$GO_TARBALL" + tar -xz -C ~/.local -f "/tmp/$GO_TARBALL" + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp "/tmp/$GO_TARBALL" "$GO_URI" + rm "/tmp/$GO_TARBALL" + fi go version - install_tarantool: | curl -L https://tarantool.io/release/3/installer.sh | sudo bash diff --git a/.builds/conformance.yml b/.builds/conformance.yml index d53942bccf3918aac24631363338edc4d8417587..983c60d42909bce1b92fae2bd9b5ca24f55eed87 100644 --- a/.builds/conformance.yml +++ b/.builds/conformance.yml @@ -69,9 +69,23 @@ echo "secret_len=${#AWS_SECRET_ACCESS_KEY}" set -x aws --endpoint-url="$AWS_ENDPOINT_URL" s3 ls "s3://$S3_BUCKET/" >/dev/null - install_go: | + GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz" + GO_KEY="golang/$GO_TARBALL" + GO_URI="s3://$S3_BUCKET/$GO_KEY" mkdir -p ~/.local - curl -sSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \ - | tar -xz -C ~/.local + if aws --endpoint-url="$AWS_ENDPOINT_URL" s3api head-object \ + --bucket "$S3_BUCKET" --key "$GO_KEY" >/dev/null 2>&1; then + echo "Cache HIT — pulling Go from S3" + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp "$GO_URI" - \ + | tar -xz -C ~/.local + else + echo "Cache MISS — downloading from go.dev and caching" + curl -sSL --retry 3 --retry-delay 5 --max-time 300 \ + "https://go.dev/dl/$GO_TARBALL" -o "/tmp/$GO_TARBALL" + tar -xz -C ~/.local -f "/tmp/$GO_TARBALL" + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp "/tmp/$GO_TARBALL" "$GO_URI" + rm "/tmp/$GO_TARBALL" + fi go version - install_tarantool: | curl -L https://tarantool.io/release/3/installer.sh | sudo bash diff --git a/.builds/pure-lua.yml b/.builds/pure-lua.yml index e3746f4f81cea3709b1113a63ab1f2f1776aec63..1413d9146091cc3a3c4b5455f356fe9bf742f1fd 100644 --- a/.builds/pure-lua.yml +++ b/.builds/pure-lua.yml @@ -6,6 +6,10 @@ - gnupg - protobuf-compiler - cmake - build-essential + - unzip +secrets: + - 7dde4219-0783-4581-a67d-c94749de3600 # ~/.s3-cache-key-id + - 0e5b3530-6f19-4f30-9b73-9339dd382e46 # ~/.s3-cache-key-secret sources: - https://git.srht.bigb.es/~bigbes/tarantool-protobuf environment: @@ -13,6 +17,9 @@ GOPATH: /home/build/go GOROOT: /home/build/.local/go GO_VERSION: "1.26.3" PATH: /home/build/.local/go/bin:/home/build/.local/bin:/home/build/go/bin:/usr/local/bin:/usr/bin:/bin + AWS_DEFAULT_REGION: garage + AWS_ENDPOINT_URL: https://s3.bigb.es + S3_BUCKET: docker-cache submitter: git.sr.ht: enabled: true @@ -20,10 +27,50 @@ allow-refs: - refs/heads/master - "refs/tags/*" tasks: + - install_awscli: | + curl -sSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" \ + -o /tmp/awscliv2.zip + unzip -q /tmp/awscliv2.zip -d /tmp + sudo /tmp/aws/install + aws --version + - aws_credentials: | + mkdir -p ~/.aws + cat > ~/.aws/config <> ~/.buildenv + echo 'export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required' >> ~/.buildenv + set +x + export AWS_ACCESS_KEY_ID=$(tr -d '[:space:]' < ~/.s3-cache-key-id) + export AWS_SECRET_ACCESS_KEY=$(tr -d '[:space:]' < ~/.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 + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 ls "s3://$S3_BUCKET/" >/dev/null - install_go: | + GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz" + GO_KEY="golang/$GO_TARBALL" + GO_URI="s3://$S3_BUCKET/$GO_KEY" mkdir -p ~/.local - curl -sSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \ - | tar -xz -C ~/.local + if aws --endpoint-url="$AWS_ENDPOINT_URL" s3api head-object \ + --bucket "$S3_BUCKET" --key "$GO_KEY" >/dev/null 2>&1; then + echo "Cache HIT — pulling Go from S3" + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp "$GO_URI" - \ + | tar -xz -C ~/.local + else + echo "Cache MISS — downloading from go.dev and caching" + curl -sSL --retry 3 --retry-delay 5 --max-time 300 \ + "https://go.dev/dl/$GO_TARBALL" -o "/tmp/$GO_TARBALL" + tar -xz -C ~/.local -f "/tmp/$GO_TARBALL" + aws --endpoint-url="$AWS_ENDPOINT_URL" s3 cp "/tmp/$GO_TARBALL" "$GO_URI" + rm "/tmp/$GO_TARBALL" + fi go version - install_tarantool: | curl -L https://tarantool.io/release/3/installer.sh | sudo bash