ottomatica/slim

Broken `slim push` logic

chrisparnin opened this issue · 1 comments

If an asset already exists, slim push will fail to push to a GitHub release asset. Current workaround is to manually delete asset and then push.

cjparnin at MacBookPro in ~/classes/519/dungeons/ubuntu-node-dungeon
$ GH_TOKEN="xxxx" slim push ubuntu-node-dungeon CSC-DevOps/Images#Spring2020
{ HttpError: request to https://uploads.github.com/repos/CSC-DevOps/Images/releases/22449587/assets?name=ubuntu-node-dungeon-slim.iso& failed, reason: write EPIPE
    at fetch.then.then.catch.error (/Users/cjparnin/projects/slim/node_modules/@octokit/request/dist-node/index.js:107:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'HttpError',
  status: 500,
  headers: {},
  request:
   { method: 'POST',
     url:
      'https://uploads.github.com/repos/CSC-DevOps/Images/releases/22449587/assets?name=ubuntu-node-dungeon-slim.iso&',
     headers:
      { accept: 'application/vnd.github.v3+json',
        'user-agent': 'octokit.js/16.36.0 Node.js/10.5.0 (macOS Catalina; x64)',
        'content-type': 'application/octet-stream',
        'content-length': 202522624,
        authorization: 'token [REDACTED]' },
     body:
      ReadStream {
        _readableState: [ReadableState],
        readable: true,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        path:
         '/Users/cjparnin/.slim/registry/ubuntu-node-dungeon/slim.iso',
        fd: 15,
        flags: 'r',
        mode: 438,
        start: undefined,
        end: Infinity,
        autoClose: true,
        pos: undefined,
        bytesRead: 1572864,
        closed: false },
     request:
      { hook: [Function: bound bound register], validate: [Object] } } }
Pushed asset: /Users/cjparnin/.slim/registry/ubuntu-node-dungeon/slim.iso

The logic for "force" re-uploading was there, but there was an error in how I check if a file exists in the current assets. Should be fixed now.