Skip to content

[PHP] Check if cached file is present before using it #264

@Frzk

Description

@Frzk

When deploying a PHP extension, the script downloads a md5 checksum of the extension and compares this value with the one computed from the cache.
If the .md5 file can't be downloaded, it seems that the script considers it's OK to go on and considers that the file in the cache is appropriate.

In my case, the file in the cache wasn't existing, which led to the following trace and error:

+ local checksum_url=https://storage.gra.cloud.ovh.net/v1/AUTH_be65d32d71a6435589a419eac98613f2/scalingo-php-buildpack/scalingo-20/package/amqp-1.11.0.md5
+ local package_url=https://storage.gra.cloud.ovh.net/v1/AUTH_be65d32d71a6435589a419eac98613f2/scalingo-php-buildpack/scalingo-20/package/amqp-1.11.0.tgz
+ sed -u 's/^/       /'
++ curl --fail --retry 3 --retry-delay 2 --connect-timeout 3 --max-time 30 https://storage.gra.cloud.ovh.net/v1/AUTH_be65d32d71a6435589a419eac98613f2/scalingo-php-buildpack/scalingo-20/package/amqp-1.11.0.md5
+ local checksum=
+ local cache_checksum=
+ '[' -f /tmp/cache/package/amqp-1.11.0.md5 ']'
++ dirname amqp-1.11.0
+ mkdir -p /tmp/cache/package/.
+ '[' '' '!=' '' ']'
+ echo 'Checksums match. Fetching from cache.'
+ mkdir -p /app/vendor/amqp
       Checksums match. Fetching from cache.
+ tar xzf /tmp/cache/package/amqp-1.11.0.tgz -C /app/vendor/amqp
tar (child): /tmp/cache/package/amqp-1.11.0.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

I suggest to check if the file is actually in the cache before using it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions