Can't find files from output in put step

Hi,

Okay. I wrote this pipeline which builds an Android apk with flutter and should upload this to a s3 bucket.

    ---
    resources:
    - name: app-sources
      type: git
      check_every: 5m
      icon: git
      source:
        uri: https://codeberg.org/Rinma/Planning-Poker-Flutter.git
    
    - name: minio
      type: s3
      source:
        bucket: planning-poker
        access_key_id:  <access_key>
        secret_access_key: <secret_key>
        endpoint: <endpoint>
        regexp: app-(.*)-release.apk
    
    jobs:
    - name: build-android
      plan:
      - get: app-sources
        trigger: true
      - task: run-flutter-build
        config:
          image_resource:
            source:
              repository: cirrusci/flutter
              tag: latest
            type: docker-image
          inputs:
          - name: app-sources
            path: /project
          outputs:
          - name: apk
            path: build/app/outputs/apk/release/
          platform: linux
          run:
            args:
            - build
            - apk
            - --split-per-abi
            dir: /project
            path: /home/cirrus/sdks/flutter/bin/flutter
            user: root
      - put: minio
        params:
          file: apk
      public: true

Now I don’t get how to use the output correctly in the put step. When I try it like this I get:

    error running command: ReadRequestBody: read upload data failed
    caused by: read /tmp/build/put/apk: is a directory

And when I try a exact file I get:

    error running command: no matches found for pattern: apk/app-arm64-v8a-release.apk

Here the output of the pipeline:

    initializing
    running /home/cirrus/sdks/flutter/bin/flutter build apk --split-per-abi
    Running "flutter pub get" in project...                             1.2s
    Initializing gradle...                                              4.6s
    Resolving dependencies...                                          25.0s
    Running Gradle task 'assembleRelease'...                        
    Calling mockable JAR artifact transform to create file: /root/.gradle/caches/transforms-1/files-1.1/android.jar/2288440c4d6773de4bf3fab5978fd5f4/android.jar with input /opt/android-sdk-linux/platforms/android-28/android.jar
    Running Gradle task 'assembleRelease'...                           56.1s

    Built build/app/outputs/apk/release/app-armeabi-v7a-release.apk (5.6MB).
    Built build/app/outputs/apk/release/app-arm64-v8a-release.apk (5.9MB).

I hope somebody can explain to me how I use this resource correctly.

The README for S3 says

file : Required. Path to the file to upload, provided by an output of a task. If multiple files are matched by the glob, an error is raised.

see https://github.com/concourse/s3-resource/issues/97

Which is kinda poor I know
You could make your own docker image and just do an s3 cp --recursive yourself

1 Like

Thanks for this hint.
I tried

  - put: minio
    params:
      file: apk/app-arm64-v8a-release.apk

but now I get the error error running command: no matches found for pattern: apk/app-arm64-v8a-release.apk but when I take a look at the console output it clearly says Built build/app/outputs/apk/release/app-arm64-v8a-release.apk (5.9MB).

Should the file app-arm64-v8a-release.apk not be available in the output apk ?

Best to do a fly intercept and have a rummage around in the container make sure everything is where you expect.

the file you are tring to put is
build/app/outputs/apk/release/apk/app-arm64-v8a-release.apk

but I thin kit looks like the file is
build/app/outputs/apk/release/app-arm64-v8a-release.apk

So you need
- put: minio
params:
file: app-arm64-v8a-release.apk

1 Like

Cool. fly hijack is a great tool.
Found the error. The path is project/build/app/outputs/apk/release/.. because I get the input to /project :man_facepalming:

Thanks for the help.