Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifacts being published to S3 when they shouldn't be #2708

Closed
IGassmann opened this issue Mar 17, 2018 · 7 comments
Closed

Artifacts being published to S3 when they shouldn't be #2708

IGassmann opened this issue Mar 17, 2018 · 7 comments

Comments

@IGassmann
Copy link

  • Version: 20.5.1
  • Target: macOS, Linux and Windows

The building artifacts are always being published to S3 and consequently, the auto-update files are being updated. This is happening on Travis CI using the following configuration:

electron-builder.json

{
  "appId": "io.lbry.LBRY",
  "productName": "LBRY",
  "publish": [
    {
      "provider": "s3",
      "bucket": "build.lbry.io",
      "path": "app/release",
      "region": "us-east-1"
    },
    "github"
  ],
  "mac": {
    "category": "public.app-category.entertainment"
  },
  "dmg": {
    "iconSize": 128,
    "contents": [
      {
        "x": 115,
        "y": 164
      },
      {
        "x": 387,
        "y": 164,
        "type": "link",
        "path": "/Applications"
      }
    ],
    "window": {
      "x": 200,
      "y": 200,
      "width": 500,
      "height": 300
    },
    "background": "./build/background.png"
  },
  "protocols": [
    {
      "name": "LBRY URI",
      "schemes": ["lbry"],
      "role": "Viewer"
    }
  ],
  "linux": {
    "target": "deb",
    "category": "AudioVideo;Video",
    "desktop": {
      "MimeType": "x-scheme-handler/lbry;"
    }
  },
  "deb": {
    "depends": [
      "gconf2",
      "gconf-service",
      "libnotify4",
      "libappindicator1",
      "libxtst6",
      "libnss3",
      "libsecret-1-0"
    ]
  },
  "nsis": {
    "perMachine": true
  },
  "beforeBuild": "./build/checkDaemonPlatform.js"
}

.travis.yml

matrix:
  include:
    - os: osx
      osx_image: xcode9.2
      language: node_js
      node_js: "9"
      env:
        - ELECTRON_CACHE=$HOME/.cache/electron
        - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
    - os: linux
      services: docker
      language: generic
before_cache:
  - rm -rf $HOME/.cache/electron-builder/wine
cache:
  directories:
  - node_modules
  - $HOME/.cache/electron
  - $HOME/.cache/electron-builder
before_install:
  - |
    if [ "$TRAVIS_OS_NAME" == "osx" ]; then
      mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v2.3.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-2.3.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1
      export PATH="/tmp/git-lfs:$PATH"
    fi
before_script:
  - git lfs pull
script:
  - |
    if [ "$TRAVIS_OS_NAME" == "linux" ]; then
      docker run --rm \
        --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
        -v ${PWD}:/project \
        -v ~/.cache/electron:/root/.cache/electron \
        -v ~/.cache/electron-builder:/root/.cache/electron-builder \
        electronuserland/builder:wine \
        /bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn build --linux --win"
    else
      yarn build
    fi
branches:
  except:
    - "/^v\\d+\\.\\d+\\.\\d+$/"
addons:
  artifacts:
    working_dir: dist
    paths:
     - $(git ls-files -o dist/{*.dmg,*.exe,*.deb} | tr "\n" ":")
    target_paths:
     - /app/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})

Here's a build on which the files were uploaded to the S3 bucket when they shouldn't have: https://travis-ci.org/lbryio/lbry-app/jobs/354537632

This is a big problem because users are prompted to upgrade their app for non-released builds and even for builds from non-master branches. I'm providing a donation for this issue.

Our repository source code fixed at the current commit: https://github.com/lbryio/lbry-app/tree/861131fd774dda6344f607290efdd6bfdf66312d

@develar
Copy link
Member

develar commented Mar 18, 2018

Could you please describe why should not?

@IGassmann
Copy link
Author

@develar According to the documentation, electron-builder is supposed to only publish if there's a draft open, the commit is tagged, or if the npm script is named release. In the build linked above, any of those cases are happening.

@develar
Copy link
Member

develar commented Mar 18, 2018

So — S3 publisher must not publish even on CI if commit is not tagged by default. (Even if version is changed in the package.json).

@IGassmann
Copy link
Author

Exactly. On that build, I changed the version on the package.json file to test the auto-update feature.

Just to be sure... the current behavior is to publish if the package.json version isn't the same than the one on S3?

@develar
Copy link
Member

develar commented Mar 18, 2018

@IGassmann Your script name is release. It means If npm script named release, — always. https://www.electron.build/configuration/publish Please try to rename your script.

@IGassmann
Copy link
Author

@develar we have a defined script named release in our package.json file, but it isn't being used in Travis as you can see in the Travis configuration file. The one being used is build.

@develar develar reopened this Mar 19, 2018
@develar develar added bug and removed reply-needed labels Mar 27, 2018
@develar
Copy link
Member

develar commented Mar 27, 2018

Thanks for spotting this issue and for donation. Problem — onTagOrDraft policy is set, but draft concept applicable only for GitHub and Bintray, not for other providers. Now we check that tag exists for such providers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants