cake-contrib / Cake.HockeyApp

This Addin for the Cake allows you to upload your package to HockeyApp.
http://cakebuild.net/dsl/hockeyapp
MIT License
4 stars 13 forks source link

UploadToHockeyApp not working #26

Open jrgcubano opened 7 years ago

jrgcubano commented 7 years ago

I just moved from Cake.HockeyApp version 0.2.3 to 0.3.1 and Cake 0.17 to 0.20 (tested with 0.18 and 0.20)

// artifacts/android/release/.....apk var workingDirectoryFullPath = Context.Environment.WorkingDirectory.FullPath; var artifactsDir = "artifacts";

Task("UploadAndroidToHockeyApp") .Does(() => { var path = $"{workingDirectoryFullPath}/{artifactsDir}/android/release/{androidPackage}"; Information(path); var apkFilePath = File(path); UploadToHockeyApp(apkFilePath, new HockeyAppUploadSettings { AppId = "appid",
ApiToken = "apptoken", // ReleaseType = ReleaseType.Beta, // Status = DownloadStatus.Allowed, // NoteType = NoteType.Markdown, // Notes = "Uploaded via cake" });
});

RunTarget("UploadAndroidToHockeyApp");

* Execution

./build.sh --script mobile.cake --verbosity diagnostic

* Output

======================================== UploadAndroidToHockeyApp

Executing task: UploadAndroidToHockeyApp /Users/jrodriguez/Projects/NET/Xamarin/check/artifacts/android/release/com.winhotelsolution.check.apk Initialized HockeyApp Api at https://rink.hockeyapp.net Uploading file to HockeyApp. This can take several minutes.... Creating Version () for f83f9b5fa7a44b7582ce699d797badfb. One or more errors occurred. String reference not set to an instance of a String. Parameter name: s An error occurred when executing task 'UploadAndroidToHockeyApp'.


Teardown

Executing custom teardown action... Finished running tasks. Error: System.Exception: Upload to Hockey App failed. at Cake.HockeyApp.HockeyAppAliases.UploadToHockeyApp (Cake.Core.ICakeContext context, Cake.Core.IO.FilePath file, Cake.Core.IO.FilePath symbolsFile, Cake.HockeyApp.HockeyAppUploadSettings settings) [0x00071] in <542037da95674b128648de6657465dcb>:0 at Cake.HockeyApp.HockeyAppAliases.UploadToHockeyApp (Cake.Core.ICakeContext context, Cake.Core.IO.FilePath file, Cake.HockeyApp.HockeyAppUploadSettings settings) [0x00000] in <542037da95674b128648de6657465dcb>:0 at CakeBuildScriptImpl.UploadToHockeyApp (Cake.Core.IO.FilePath file, Cake.HockeyApp.HockeyAppUploadSettings settings) [0x00006] in :0 at CakeBuildScriptImpl+cAnonStorey1.<>m1B () [0x0005e] in :0 at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass5_0.b__0 (Cake.Core.ICakeContext context) [0x00000] in <5b31f5a87daa44669c1990c3ebac72fd>:0 at Cake.Core.ActionTask.Execute (Cake.Core.ICakeContext context) [0x00015] in <5b31f5a87daa44669c1990c3ebac72fd>:0 at Cake.Core.DefaultExecutionStrategy.Execute (Cake.Core.CakeTask task, Cake.Core.ICakeContext context) [0x00066] in <5b31f5a87daa44669c1990c3ebac72fd>:0 at Cake.Core.CakeEngine.ExecuteTask (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeTask task, Cake.Core.CakeReport report) [0x0007b] in <5b31f5a87daa44669c1990c3ebac72fd>:0 at Cake.Core.CakeEngine.RunTarget (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, System.String target) [0x000ff] in <5b31f5a87daa44669c1990c3ebac72fd>:0 at Cake.Scripting.BuildScriptHost.RunTarget (System.String target) [0x00018] in <048c7da9ad3749dbb879705d4614451b>:0 at Cake.Scripting.Mono.CodeGen.CakeBuildScriptImplBase.RunTarget (System.String target) [0x00006] in <048c7da9ad3749dbb879705d4614451b>:0 at CakeBuildScriptImpl.Execute () [0x00950] in :0 at .Host (System.Object& $retval) [0x0000a] in :0 at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x0003e] in :0 at Mono.CSharp.Evaluator.Run (System.String statement) [0x00000] in :0 at Cake.Scripting.Mono.MonoScriptSession.Execute (Cake.Core.Scripting.Script script) [0x0004b] in <048c7da9ad3749dbb879705d4614451b>:0 at Cake.Core.Scripting.ScriptRunner.Run (Cake.Core.Scripting.IScriptHost host, Cake.Core.IO.FilePath scriptPath, System.Collections.Generic.IDictionary`2[TKey,TValue] arguments) [0x002b2] in <5b31f5a87daa44669c1990c3ebac72fd>:0 at Cake.Commands.BuildCommand.Execute (Cake.CakeOptions options) [0x00026] in <048c7da9ad3749dbb879705d4614451b>:0 at Cake.CakeApplication.Run (Cake.CakeOptions options) [0x00015] in <048c7da9ad3749dbb879705d4614451b>:0 at Cake.Program.Main () [0x000bb] in <048c7da9ad3749dbb879705d4614451b>:0

gep13 commented 7 years ago

@jrgcubano does this problem only occur when you uncomment the commented out lines in the Cake script?

jrgcubano commented 7 years ago

@gep13 Sorry for not answering, I was on vacation.

It always happens, it does not matter with the comments or not.

gep13 commented 7 years ago

@jrgcubano I will need to dig into this some more, as I can't see anything obvious that would be stopping this from working.

Has this ever worked for you? Or only in the new releases that you are seeing problems?

mikegottlieb commented 7 years ago

This used to work for me, but I recently updated from Cake 0.17.0 to 0.21.1 and now it no longer works.

mikegottlieb commented 7 years ago

Here is the command I'm executing.

var apkPath = AndroidPackage(androidProjectFile, true, (settings) => { settings.Configuration = config; });
    UploadToHockeyApp(
      apkPath,
            null,
      new HockeyAppUploadSettings
      {
        AppId = "<my_app_id>",
        ReleaseType = ReleaseType.Alpha,
        Status = DownloadStatus.Allowed,
        Notes = "Uploaded via Cakebuild",
        Teams = new Int32[] { <my_team_id> }
      }
    );
RLittlesII commented 7 years ago

@mikegottlieb This is what I found out.

The Hockey App Api Documentation states

  • bundle_version - mandatory, set to CFBundleVersion (iOS and OS X) or to versionCode (Android)

This translates to the HockeyAppUploadSettings.Version so the following worked fine with version 0.6.0

        UploadToHockeyApp(apkPath, null, new HockeyAppUploadSettings
        {
            AppId = "<ApiKey>",
            Status = DownloadStatus.Allowed,
            Version = "1"
        });

Currently it is a mandatory field that doesn't alert you when the version isn't provided, instead the API returns a 422 HTTP status code.

mikegottlieb commented 7 years ago

@RLittlesII Looks like that fixed it for Android, but I still get an error trying to upload an iOS build.

One or more errors occurred.
Processing error: Build does not contain a Payload directory.
An error occurred when executing task 'hockeyapp_release'.
Error: Upload to Hockey App failed.
RLittlesII commented 7 years ago

@mikegottlieb And of course I didn't test iOS. I'll dig into this tonight.

mikegottlieb commented 7 years ago

Also FYI specifying the Version sets the BuildVersion in HockeyApp, but it doesn't set the real version name so you end up with an unnamed version. Specifying the ShortVersion fixes this.

I'm following up with someone from the HockeyApp team as well about the Payload issue.

Thanks for looking into this.

RLittlesII commented 7 years ago

@mikegottlieb Yeah. The way Cake.HockeyApp works is it uses the Create Version API, before it uploads your app. So it creates a version and part of what it takes to create a version is Version and Short Version (optional). So for best results you're better off providing both. They payload issue sounds interesting. I'll dig to see if it's HockeyApp API returning another HTTP status code, or if it is Cake.HockeyApp failing to pass on the ipa.

Your welcome. Keep me posted.

mikegottlieb commented 7 years ago

@RLittlesII Seems like things are broken when you specify the app id, but they work otherwise.

RLittlesII commented 7 years ago

@mikegottlieb It follows two different logical paths. If you don't provide AppId it does an upload. If you provide an AppId it creates a new version and proceeds to upload to that version.

Curious when you say it works, does that mean it looks correct in HockeyApp, or that the upload doesn't error?

mikegottlieb commented 7 years ago

When I say it works I mean it both looks correct in HockeyApp and the upload doesn't error. It created a new version if one does not exist.

RLittlesII commented 7 years ago

@mikegottlieb I am at the point I think I we need two public alias methods for Upload. One that will use the Upload API, another using the Create Version API + the Upload Version API.
Can you verify your current status. Have you found an acceptable working configuration of Cake.HockeyApp for both iOS and Android? If yes, could you share that configuration?

mikegottlieb commented 7 years ago

I ended up downgrading to 0.2.3 which was the last working version. I downgraded in part because I downgraded my entire application back to Xamarin.Forms 2.3.3 from 2.3.4 because too many things were broken and I've given up trying to stay current with the Xamarin team.