avazula
avazula

Reputation: 482

How to upload an app bundle (.aab) onto my private Nexus repository?

I have a GitLab CI pipeline that builds an Ionic app and then uploads it onto my Nexus Maven repository. I generate both an apk and an aab file that I upload via cURL. However, even though the APK file is properly pushed to the repo, the AAB file is nowhere to be found.

.gitlab-ci.yml file:

build-apk:
  stage: build
  tags: [docker]
  script:
    - rm package-lock.json
    - npm install -g [email protected] [email protected]
    - npm run build:android:$STAGE
    - cd platforms/android
    - ./gradlew bundleRelease
    - cd ../..
    - echo $ANDROID_DEBUG_KEYSTORE | base64 --decode > key.keystore
    - mv platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk app-release.apk
    - mv platforms/android/app/build/outputs/bundle/release/app.aab $CI_PROJECT_NAME.aab
    - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore -storepass "$ANDROID_DEBUG_PASSPHRASE" app-release.apk <keyName>
    - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore -storepass "$ANDROID_DEBUG_PASSPHRASE" $CI_PROJECT_NAME.aab <keyName>
    - $ANDROID_SDK_ROOT/build-tools/30.0.2/zipalign 4 app-release.apk $CI_PROJECT_NAME.apk

deploy-mobile:
  stage: deploy
  tags: [shell]
  cache: {}
  script:
    - curl -u $NEXUS_USER:$NEXUS_PWD -v --upload-file $CI_PROJECT_NAME.aab $NEXUS_MAVEN/$CI_PROJECT_NAME/$CI_PROJECT_NAME-$TAG.aab
    - curl -u $NEXUS_USER:$NEXUS_PWD -v --upload-file $CI_PROJECT_NAME.apk $NEXUS_MAVEN/$CI_PROJECT_NAME/$CI_PROJECT_NAME-$TAG.apk
  dependencies:
    - build-apk

When I compare the logs of both commands the only difference I see is that the HTTP answer is 400 bad request for the aab upload (the apk upload ends with 201 Created).

Is there any missing information I should add to my cURL command so that the aab file uploads? Am I obliged to use Maven commands to upload an aab file?

Upvotes: 2

Views: 1539

Answers (1)

avazula
avazula

Reputation: 482

The issue was coming from my repository's configuration, as it didn't allow uploads of files that do not meet the MIME requirements. Unchecking the option led to a successful upload.
Next step is to figure out whether it is possible with my NXRM version to add support for custom MIME types, as it does not feel right to disable validation for all files present in the repository.

Repository configuration: the checkbox for validating that all content is of a MIME type appropriate for a Maven repository is checked

Upvotes: 3

Related Questions