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

releaseNotesParameter are not taken into consideration #31

Open Averus89 opened 6 years ago

Averus89 commented 6 years ago

Hi,

I'm using 2.0 version of the plugin in Jenkins 2.121.1 and unfortunately I'm unable to send release notes via FabricBetaPublisher with Multibranch Pipeline project. Here is my fabric step configuration

    step([
        $class: 'FabricBetaPublisher',
        apiKey: 'XXXX',
        buildSecret: 'XXXX',
        releaseNotesType: 'RELEASE_NOTES_PARAMETER',
        releaseNotesParameter: "Automatic Jenkins Release (DEV)",
        notifyTestersType: 'NOTIFY_TESTERS_GROUP',
        testersGroup: 'All',
        apkPath: "app/build/outputs/apk/debugDev/*.apk",
        organization: "XXXX",
        useAntStyleInclude: true
    ])

Jenkins output for this step

Fabric Beta Publisher Plugin:
Temporary crashlytics3252393483183903161.zip got deleted = true
Setting environment variable FABRIC_BETA_BUILD_URL = https://fabric.io/Example/android/apps/com.example/beta/releases/1d8fb8e6-8cba-4f89-b2c4-2d438e4a7fa4?build_version=33912&display_version=3.39.12-Pre-3.39.13-253c69b
Setting environment variable FABRIC_BETA_BUILD_URL_0 = https://fabric.io/Example/android/apps/com.example/beta/releases/xxxxxx?build_version=33912&display_version=3.39.12-Pre-3.39.13-253c69b
Executing command: [java, -jar, /tmp/crashlytics-devtools8572702572658773974.jar, -androidRes, ., -apiKey, XXXX, -apiSecret, XXXX, -androidManifest, /tmp/xml5541236055410881989.tmp, -uploadDist, /mnt/jenkins/jenkins_home/workspace/app_dev-hash/app/build/outputs/apk/debugDev/app-debugDev.apk, -betaDistributionNotifications, true, -betaDistributionGroupAliases, All]
Temporary xml5541236055410881989.tmp got deleted = true
Temporary crashlytics-devtools8572702572658773974.jar got deleted = true

Crashalytics email received

AppName3.39.12-Pre-3.39.13-253c69b(33912)
--
Download the latest build of AppName by tapping the button below on your mobile device.You can also use the Crashlytics icon on your home screen to download builds of all the apps you’re testing.
egor-n commented 6 years ago
releaseNotesType: 'RELEASE_NOTES_PARAMETER',
releaseNotesParameter: "Automatic Jenkins Release (DEV)",

This means that Jenkins will look for a environment variable called "Automatic Jenkins Release (DEV)".

If you want to specify a static changelog through Fabric Beta Publisher then you can define an environment variable in Jenkins AUTOMATIC_RELEASE_NOTES_BODY = "Automatic Jenkins Release (DEV)". Then use it in the pipeline:

releaseNotesType: 'RELEASE_NOTES_PARAMETER',
releaseNotesParameter: 'AUTOMATIC_RELEASE_NOTES_BODY',
Averus89 commented 6 years ago

Hi,

I'm using multibranch pipeline so I can't setup an environment variable in pipeline config, so I've tried to use withEnv(['MESSAGE=xxxxxx']) and also env.MESSAGE = 'xxxxxx' unfortunately this is same result for both cases

    stage('Upload to Fabric') {
        withEnv(['MESSAGE=Automatic DEV Jenkins Build']){
            withCredentials([string(credentialsId: 'fabric-api-key', variable: 'API_KEY'), string(credentialsId: 'fabric-build-secret', variable: 'BUILD_SECRET')]){
                step([
                $class: 'FabricBetaPublisher',
                apiKey: API_KEY,
                buildSecret: BUILD_SECRET,
                releaseNotesType: 'RELEASE_NOTES_PARAMETER',
                notifyTestersType: 'NOTIFY_TESTERS_GROUP',
                releaseNotesParameter: 'MESSAGE',
                apkPath: "app/build/outputs/apk/debugDev/*.apk",
                testersGroup: TESTERS_GROUP,
                organization: ORG_NAME,
                useAntStyleInclude: true
                ])
            }
        }
    }
Fabric Beta Publisher Plugin:
Temporary crashlytics7434298934794876914.zip got deleted = true
Setting environment variable FABRIC_BETA_BUILD_URL = https://fabric.io/Example/android/apps/com.example/beta/releases/xxxxx?build_version=33912&display_version=3.39.12-Pre-3.39.13-ba8366a
Setting environment variable FABRIC_BETA_BUILD_URL_0 = https://fabric.io/Example/android/apps/com.example/beta/releases/xxxxx?build_version=33912&display_version=3.39.12-Pre-3.39.13-ba8366a
Executing command: [java, -jar, /tmp/crashlytics-devtools8095768377736803709.jar, -androidRes, ., -apiKey, ****, -apiSecret, ****, -androidManifest, /tmp/xml6435738162507554038.tmp, -uploadDist, /mnt/jenkins/jenkins_home/workspace/app_dev-xxxxx/app/build/outputs/apk/debugDev/app-debugDev.apk, -betaDistributionNotifications, true, -betaDistributionGroupAliases, All]
Temporary xml6435738162507554038.tmp got deleted = true
Temporary crashlytics-devtools8095768377736803709.jar got deleted = true

It worked however with RUN_CHANGES_DISPLAY_URL

Fabric Beta Publisher Plugin:
Temporary crashlytics6620272965613581605.zip got deleted = true
Setting environment variable FABRIC_BETA_BUILD_URL = https://fabric.io/Example/android/apps/com.example/beta/releases/xxxxxx?build_version=33912&display_version=3.39.12-Pre-3.39.13-ba8366a
Setting environment variable FABRIC_BETA_BUILD_URL_0 = https://fabric.io/Example/android/apps/com.example/beta/releases/xxxxx?build_version=33912&display_version=3.39.12-Pre-3.39.13-ba8366a
Executing command: [java, -jar, /tmp/crashlytics-devtools8039298625099388227.jar, -androidRes, ., -apiKey, ****, -apiSecret, ****, -androidManifest, /tmp/xml633860326351190073.tmp, -uploadDist, /mnt/jenkins/jenkins_home/workspace/app-xxxxx/app/build/outputs/apk/debugDev/app-debugDev.apk, -betaDistributionNotifications, true, -betaDistributionGroupAliases, Alan, -betaDistributionReleaseNotes, http://example.com/job/app/job/dev/1/display/redirect?page=changes]
Temporary xml633860326351190073.tmp got deleted = true
Temporary crashlytics-devtools8039298625099388227.jar got deleted = true
egor-n commented 6 years ago

@Averus89 does sh 'echo $MESSAGE' print the correct message to logs?

egor-n commented 6 years ago

Ah, I see now. The plugin doesn't have access to environment variables defined using withEnv because of JENKINS-29144.

As this issue is already 3 years old, I don't think it will be closed any time soon. There should be another solution without using withEnv.

@Averus89 is my understanding correct that you require the changelog to be the same value for all builds? Maybe we could add this to the plugin as another configuration option – provide changelog by simply passing some text.

Averus89 commented 5 years ago

@egor-n yeah changelog parameter would help with the mentioned case.