Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,628
Community Members
 
Community Events
176
Community Groups

How do I upload a release to Nucleus?

Edited

I'm using Atlassian Nucleus and I've been trying to post my electron application release and failing.

I have a local Docker container set up for Nucleus and I can post releases using electron-forge; the files appear, versioned and ready to rock and roll.

I've written a javascript form and I've been attempting to post the release this way as I use electron-packager (electron-forge packages hit just south of a gigabyte while electron-packager prunes to under 300mb).

The form works well enough but I can't seem to post files to Nucleus.

This was my latest iteration:

<form id="release_form">
  <label for="server_address">Enter an address for an update server to post to.<br><sup>This defaults to localhost:3030</sup></label>
  <input id="server_address" type="text" placeholder="http://localhost:3030" />
  <label for="release_package">Select the folder to upload.</label>
  <input id="release_package" type="file" />
  <input id="submit_release" type="submit" />
</form>
<script>
  (function($) {
    const release_package = document.getElementById('release_package');
    const server_address = document.getElementById('server_address');
    const submit_release = document.getElementById('submit_release');

    $('#release_form').on('submit', function(e) {
      e.preventDefault();
      submit_release.disabled = true;
      if (release_package.value) {
        console.log(release_package.value);

        const data = new FormData();
        data.append('platform', 'darwin');
        data.append('arch', 'x64');
        data.append('version', '0.3.0');

        let reader = new FileReader();
        reader.onload = () => {
          data.append(`file`, reader.result);

          const config = {
            host: (server_address.value) ? server_address.value : 'http://localhost:3030',
            appId: '1',
            channelId: 'channel_id',
            token: 'token'
          }

          fetch(`${config.host}/rest/app/${config.appId}/channel/${config.channelId}/upload`, {
            headers: {
              'Authorization': config.token
            },
            method: 'POST',
            body: data,
          }).then((response) => {
            if (response.status !== 200) {
              console.error(`Unexpected response code from Nucleus: ${response.status}`);
            }
            console.log(response);
          }).finally(() => {
            submit_release.disabled = false;
          });
        }

        reader.readAsBinaryString(release_package.files[0]);

      }
    });
  })(jQuery);
</script>

This iteration comes after several other attempts using various approaches all of which were derived from the suggested example in Electron-Forge's NodeJS publishing code.

The above code results in a 500 error. Attempting to use release_package.files[0] directly results in a 400 error.

Any help would be greatly appreciated.

Edit:

Solved; it turns out, using Fetch, I wasn't seeing the error being returned by Nucleus which specified the filename has to include the version number.

The form works perfectly; it was the filename that was causing issues, hence the 400 error.  Once I added the version number to the filename, Nucleus accepted the release package without issue.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events