jenkinsci / fabric-beta-publisher-plugin

DEPRECATED: A Jenkins plugin that lets you publish Android apps to Fabric Beta
MIT License
24 stars 17 forks source link

build status: FAILURE from last update #29

Closed mtrakal closed 6 years ago

mtrakal commented 6 years ago

From last update of lib, we can't make Success build. Everytime when we try to upload to fabric, it upload file, but build status is: FAILURE.

We use jenkinsfile and pipelines.

we use this command to upload apk to fabric:

step([
                    $class            : 'FabricBetaPublisher',
                    apiKey            : "API_KEY",
                    apkPath           : "**/mobile/build/outputs/apk/prodGoogle/release/*-release-signed.apk",
                    buildSecret       : "BUILD_SECRET",
                    notifyTestersType : 'NOTIFY_TESTERS_GROUP',
                    releaseNotesType  : 'RELEASE_NOTES_FILE',
                    releaseNotesFile  : "$WORKSPACE/crashlytics_release_notes.txt",
                    testersGroup      : "groupAlpha",
                    organization      : "myorganization",
                    useAntStyleInclude: true
            ])
Build status: null
Fabric Beta Publisher Plugin:
Temporary crashlytics2315833050588937344.zip got deleted = true
Setting environment variable FABRIC_BETA_BUILD_URL = https://fabric.io/mycompany/android/apps/package_name/beta/releases/8d9e27fa-AAAA-AAAA-AAAA-780040e42e5d?build_version=51&display_version=5.1
Setting environment variable FABRIC_BETA_BUILD_URL_0 = https://fabric.io/mycompany/android/apps/package_name/beta/releases/8d9e27fa-AAAA-AAAA-AAAA-780040e42e5d?build_version=51&display_version=5.1
Executing command: [java, -jar, /tmp/crashlytics-devtools6018155393607309258.jar, -androidRes, ., -apiKey, SOME_API_KEY, -apiSecret, SOME_SECRET, -androidManifest, /tmp/xml5309779191506817007.tmp, -uploadDist, /var/jenkins_home/workspace/AndroidMulti_master-YRC2HPU5EJKH3L4VWVFLJBYEUIBGSHS3ZEZGOBWGZAA23GLNBIHQ/mobile/build/outputs/apk/prodGoogle/release/mobile-prodGoogleRelease-5.1.13-master-release-signed.apk, -betaDistributionNotifications, true, -betaDistributionGroupAliases, groupAlpha, -betaDistributionReleaseNotes, Merged in develop (pull request #1079)
* Fix freeze
- Remove hashtag migration helper
Picked up _JAVA_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:-UseGCOverheadLimit
Temporary xml5309779191506817007.tmp got deleted = true
Temporary crashlytics-devtools6018155393607309258.jar got deleted = true
Build status: FAILURE
egor-n commented 6 years ago

Starting with 2.0, the releaseNotesFile takes a relative path instead of absolute.

In your case, releaseNotesFile: "$WORKSPACE/crashlytics_release_notes.txt" has to be changed to releaseNotesFile: "crashlytics_release_notes.txt".

mtrakal commented 6 years ago

Thank you, I couldn't found any release notes in this repo. I'll try with our next release, that it help and will notify here. Thanks

mtrakal commented 6 years ago

still same for our build :/. upload 40 MB apk took so long (maybe 2-5 minutes on our 1 gbit/s link to internet). So maybe jenkins recognize it as timeout, or something? Release notes are posted with build with releaseNotesFile: "$WORKSPACE/crashlytics_release_notes.txt" same as releaseNotesFile: "crashlytics_release_notes.txt", so it shouldn't be an issue

egor-n commented 6 years ago

@mtrakal do you see any logs other than the ones you posted above? Without logs/stacktrace it is impossible to debug.

mtrakal commented 6 years ago

I know, but we don't have any other logs around :(. I'm searching about some debuging jenkinsfile and showing detail logs, so I'll try notify again later when I'll have some result. Or do you have some suggestion what I can try?

egor-n commented 6 years ago

Make sure you are not ignoring exceptions in any of the catch blocks.

mtrakal commented 6 years ago

I have only one try/catch block around complete project just for cleanup workspace and code didn't jump inside.

def fabric(String flavorName) {
    stage('Fabric') {
        echo "Build status: ${currentBuild.result}"
        timeout(time: 1, unit: "HOURS") {
            notifyInput("Fabric")
            input "Deploy to Fabric?"
        }
        echo "Build status: ${currentBuild.result}"

        milestone()
        echo "Build status: ${currentBuild.result}"
        echo "Signing APK with production key"
        signAndroidApks(keyStoreId: "wallet_production_key",
                keyAlias: "wallet",
                apksToSign: "**/mobile/build/outputs/apk/prodGoogle/release/*.apk",
                archiveSignedApks: true,
                archiveUnsignedApks: false)

        echo "Build status: ${currentBuild.result}"
        echo "Deploying to Fabric"
        step([
                $class            : 'FabricBetaPublisher',
                apiKey            : "apiKey",
                apkPath           : "**/mobile/build/outputs/apk/prodGoogle/release/*-release-signed.apk",
                buildSecret       : "apiSecret",
                notifyTestersType : 'NOTIFY_TESTERS_GROUP',
                releaseNotesType  : 'RELEASE_NOTES_FILE',
                releaseNotesFile  : "crashlytics_release_notes.txt",
                testersGroup      : "mtrakal",
                organization      : "mycompany",
                useAntStyleInclude: true
        ])
        echo "Build status: ${currentBuild.result}"
    }
}

Result

Deploy to Fabric?
Proceed or Abort
Approved by mtrakal
Build status: null
Trying to pass milestone 0
Build status: null
Signing APK with production key
[SignApksBuilder] finished signing APKs
Build status: null
Deploying to Fabric
Fabric Beta Publisher Plugin:
Temporary crashlytics848448389857237159.zip got deleted = true
Setting environment variable FABRIC_BETA_BUILD_URL = https://fabric.io/company/android/apps/myapp/beta/releases/34d8cd8d-0a34-4523-8979-50992d933dd6?build_version=5134&display_version=5.1.14
Setting environment variable FABRIC_BETA_BUILD_URL_0 = https://fabric.io/company/android/apps/myapp/beta/releases/34d8cd8d-0a34-4523-8979-50992d933dd6?build_version=5134&display_version=5.1.14
Executing command: [java, -jar, /tmp/crashlytics-devtools1364016789632435317.jar, -androidRes, ., -apiKey, apikey, -apiSecret, apisecret, -androidManifest, /tmp/xml5835989781159713441.tmp, -uploadDist, /var/jenkins_home/workspace/ndroidMulti_bug_jenkinsfile-KOA5BLHIMEG5NM4XPC6ODQYLPPDVEFDSDIM2EQVK2GRGV63JLZLQ@2/mobile/build/outputs/apk/prodGoogle/release/mobile-prodGoogleRelease-5.1.14-bug-jenkinsfile-release-signed.apk, -betaDistributionNotifications, true, -betaDistributionGroupAliases, mtrakal, -betaDistributionReleaseNotes, * Jenkinsfile: fix Fabric Beta Publisher plugin]
Picked up _JAVA_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:-UseGCOverheadLimit
Temporary xml5835989781159713441.tmp got deleted = true
Temporary crashlytics-devtools1364016789632435317.jar got deleted = true
Build status: FAILURE
egor-n commented 6 years ago

Do you throw the exception again inside the catch block? As I see it, the clean-up process should happen in finally and the catch block should just propagate the exception higher so it gets printed to console logs.

mtrakal commented 6 years ago

sure, in catch block I just shown errors and set build status. in finally block clean project, I wasn't clear in prev. msg.

node {
    try {
        ... code ...
    } catch (e) {
        echo "Exception thrown"
        echo e.toString()
        // If there was an exception thrown, the build failed
        result = Status.FAILURE
        throw e
    } finally {
        clean()
        setResult(result)
        notifyStatus(result, getStatusColor(result))
    }
}

We tried downgrade (too late) to previous version of this plugin, and surprise was, that it happen too. So it looks, that plugin must be ok, and crash must caused some other settings/config/updated plugin. Crazy is, that it happen while runing this plugin. So we think, that must be by update this plugin, but it looks on something another :/

I'm so sorry for your time, I'll notify when we will know what happens with our jenkins that caused this issue.

mtrakal commented 6 years ago

Hi, everything was caused by memory limitation :(. Heap or java memory limit. But it's interesting, that build, lint, everything is working, only crash inside this plugin. And it must be after upload, because apk file is propagated to fabric website.

Only message about OOM error is note in log Picked up _JAVA_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:-UseGCOverheadLimit, no crash, no exception, only this non-self described note.

I'm so sorry again for your time.