Skip to content

Unusable Buildpacks If Upload Fails #1625

@johha

Description

@johha

Issue

If a buildpack is uploaded (via CC API or CF-CLI) and the bits upload fails (e.g. due to network issues) the buildpack will be still listed by cf buildpacks and seems usable. However the buildpack is not usable and push operations will fail with Unsupported buildpack type.
This can also lead to issues when updating an existing buildpack. In that case the error can be even more confusing as the buildpack worked before.

Context

This is relevant for foundries in landscapes where there is only limited internet access and thus offline buildpacks are needed.

Steps to Reproduce

  1. Create Buildpack with CF CLI (cancel while uploading bits)

    $ cf create-buildpack test_buildpack bp.zip 100
    
    Creating buildpack test_buildpack as provisioned_user_cf_admin...
    OK
    
    Uploading buildpack test_buildpack as provisioned_user_cf_admin...
    1.56 MiB / 1.01 GiB [>----------------------------------------------------------------------------------------------------------------------------] 0.15%^C

    Alternatively buildpack can be created with v3 API (v2 shows the same behavior).
    Uploading of bits can be neglected as the error is the same.

    $ curl "$CF_API/v3/buildpacks" \
      -X POST \
      -H "Authorization: $(cf oauth-token | grep bearer)" \
      -H "Content-type: application/json" \
      -d '{
        "name": "cf7_buildpack",
        "position": 42,
        "enabled": true,
        "locked": false,
        "stack": "cflinuxfs3"
      }'
  2. Push app

    $ cf push test_app  -b test_buildpack --no-route
    Pushing app test_app to org test-org / space my-test as provisioned_user_cf_admin...
    Getting app info...
    Creating app with these attributes...
    + name:         test_app
      path:         /tmp
      buildpacks:
    +   test_buildpack
    
    Creating app test_app...
    Comparing local files to remote cache...
    Packaging files to upload...
    Uploading files...
    110.73 KiB / 110.73 KiB [=======================================================================================================================] 100.00% 1s
    
    Waiting for API to complete processing files...
    
    Staging app and tracing logs...
    Unexpected Response
    Response code: 500
    CC code:       0
    CC error code:
    Request ID:    110e7004-0ac5-46b0-492b-92e6512a3a79::a0c9ac76-d220-4559-87a4-fed3a7ef78d6
    Description:   {
      "description": "Stager error: Unsupported buildpack type: 'test_buildpack'",
      "error_code": "CF-StagerError",
      "code": 170011
    }

Expected result

I would expect that the buildpack can't be used at all and is not shown under cf-buildpacks.
Furthermore the error message does not indicate an issue with the buildpack but instead rather indicates an app issue.

Current result

Stager error: Unsupported buildpack type: 'test_buildpack'

Possible Fix

Correct/better behavior would be to make a buildpack first available for usage (cf-buildpacks) after the bits are uploaded/available.

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