Skip to content

Commit

Permalink
ci: fix cache from
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Nov 14, 2024
1 parent 163323c commit 9cdea04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
13 changes: 6 additions & 7 deletions .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ runs:
platforms: ${{ inputs.platform }}
build-args: |
CARGO_BUILD_PROFILE=${{ inputs.cargo_profile }}
# RUSTC_WRAPPER=sccache
# SCCACHE_BUCKET=${{ inputs.bucket }}
# SCCACHE_REGION=${{ inputs.region }}
# SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache
# AWS_ACCESS_KEY_ID=${{ inputs.aws_access_key_id }}
# AWS_SECRET_ACCESS_KEY=${{ inputs.aws_secret_access_key }}
# AWS_REGION=${{ inputs.region }}
RUSTC_WRAPPER=sccache
SCCACHE_BUCKET=${{ inputs.bucket }}
SCCACHE_REGION=${{ inputs.region }}
SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache
AWS_ACCESS_KEY_ID=${{ inputs.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY=${{ inputs.aws_secret_access_key }}
cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }}
cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }}
# cache-from: type=registry,ref=${{ inputs.image_org }}/${{ inputs.image_name }}:build-cache
Expand Down
9 changes: 6 additions & 3 deletions .github/actions/s3-layer-cache-settings/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ runs:
region: '${{ inputs.region }}',
bucket: '${{ inputs.bucket }}',
prefix: '${{ inputs.prefix }}',
name: manifestNames.join(';'),
};
const settingsString = Object.entries(settings)
.filter(([,value]) => value !== '')
.map(([key, value]) => `${key}=${value}`)
.join(',');
core.setOutput('cache_from', settingsString);
core.setOutput('cache_to', `${settingsString},mode=${{ inputs.mode }}`);
const cacheFrom = manifestNames
.map((name) => `${settingsString},name=${name}`)
.join('\n');
core.setOutput('cache_from', cacheFrom);
core.setOutput('cache_to', `${settingsString},mode=${{ inputs.mode }},name=${manifestNames.join(';')}`);
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ RUN <<EOS
echo "export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> /root/env
# AWS_SECRET_ACCESS_KEY is a secret so we load it using ONBUILD ARG later on
echo "export SCCACHE_BUCKET='${SCCACHE_BUCKET}'" >> /root/env
echo "export SCCACHE_S3_USE_SSL=true" >> /root/env
# echo "export SCCACHE_S3_USE_SSL=true" >> /root/env
echo "export SCCACHE_S3_KEY_PREFIX='${SCCACHE_S3_KEY_PREFIX}/${TARGETARCH}/linux-musl'" >> /root/env
elif [ -n "${SCCACHE_MEMCACHED}" ]; then
# memcached
Expand Down

0 comments on commit 9cdea04

Please sign in to comment.