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

Updates were rejected because the tag already exists in the remote #48

Closed
iki opened this issue Aug 1, 2019 · 3 comments
Closed

Updates were rejected because the tag already exists in the remote #48

iki opened this issue Aug 1, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@iki
Copy link

iki commented Aug 1, 2019

First release on https://github.com/iki/expenses-app-react-ts-gql worked ok. Then I deleted and recreated repo, tried again and encountered the issue repeatedly since then.

It seems that https://github.com/qiwi/semantic-release-gh-pages-plugin tries to create a release tag that is already created by https://github.com/semantic-release/git.

Didn't help repeatedly:

  • hard resetting local/remote master before the release commit + removing local/remote release tags + removing local/remote gh_pages branch
  • same as above + deleting GitHub repo and creating again

Worked ok repeatedly with any of these changes in .releaserc.yml`:

  • removed @qiwi/semantic-release-gh-pages-plugin
  • or removing @semantic-release/git
  • or replacing @semantic-release/git with @semantic-release/github

Failing configuration:

plugins:
  - '@semantic-release/commit-analyzer'
  - '@semantic-release/release-notes-generator'
  - '@semantic-release/changelog'
  - '@semantic-release/git'
  -
    - '@qiwi/semantic-release-gh-pages-plugin'
    -
      src: build
      msg: 'deploy(gh-pages): {{=it.nextRelease.gitTag}}'

release:
  branch: master

Using current versions:

  "devDependencies": {
    "@qiwi/semantic-release-gh-pages-plugin": "^1.10.4",
    "@semantic-release/changelog": "^3.0.4",
    "@semantic-release/git": "^7.0.16",
    "semantic-release": "^15.13.19"
  },

Failing debug log:

yarn run v1.12.3
$ yarn run-env semantic-release --no-ci --debug
=== yarn run-env semantic-release --no-ci --debug
$ sh -c "dotenv -e .env -e .env.local -e .env.${NODE_ENV:=development} -e .env.${NODE_ENV:=development}.local -- $@" -- semantic-release --no-ci --debug
[7:12:49 PM] [semantic-release] » i  Running semantic-release version 15.13.19
  semantic-release:config load config from: C:\Users\iki\..src\expenses-app-react-ts-gql\.releaserc.yml +0ms
  semantic-release:config options values: {
  semantic-release:config   branch: 'master',
  semantic-release:config   repositoryUrl: 'git+https://github.com/iki/expenses-app-react-ts-gql',
  semantic-release:config   tagFormat: 'v${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     '@semantic-release/release-notes-generator',
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git',
  semantic-release:config     [ '@qiwi/semantic-release-gh-pages-plugin', [Object] ]
  semantic-release:config   ],
  semantic-release:config   release: { branch: 'master' },
  semantic-release:config   _: [],
  semantic-release:config   ci: false,
  semantic-release:config   debug: true,
  semantic-release:config   '$0': 'node_modules\\semantic-release\\bin\\semantic-release.js',
  semantic-release:config   noCi: true
  semantic-release:config } +5ms
  semantic-release:plugins options for @semantic-release/changelog/verifyConditions: {} +0ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
  semantic-release:plugins options for @semantic-release/git/verifyConditions: {} +6ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "verifyConditions" from "@semantic-release/git"
  semantic-release:plugins options for @qiwi/semantic-release-gh-pages-plugin/verifyConditions: { src: 'build', msg: 'deploy(gh-pages): {{=it.nextRelease.gitTag}}' } +3ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "verifyConditions" from "@qiwi/semantic-release-gh-pages-plugin"
  semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {} +8ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
  semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: {} +4ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +3ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "prepare" from "@semantic-release/changelog"
  semantic-release:plugins options for @semantic-release/git/prepare: {} +4ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "prepare" from "@semantic-release/git"
  semantic-release:plugins options for @qiwi/semantic-release-gh-pages-plugin/publish: { src: 'build', msg: 'deploy(gh-pages): {{=it.nextRelease.gitTag}}' } +5ms
[7:12:50 PM] [semantic-release] » √  Loaded plugin "publish" from "@qiwi/semantic-release-gh-pages-plugin"
[7:12:50 PM] [semantic-release] » √  Run automated release from branch master
[7:12:56 PM] [semantic-release] » √  Allowed to push to the Git repository
[7:12:56 PM] [semantic-release] » i  Start step "verifyConditions" of plugin "@semantic-release/changelog"
[7:12:56 PM] [semantic-release] » √  Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[7:12:56 PM] [semantic-release] » i  Start step "verifyConditions" of plugin "@semantic-release/git"
[7:12:56 PM] [semantic-release] » √  Completed step "verifyConditions" of plugin "@semantic-release/git"
[7:12:56 PM] [semantic-release] » i  Start step "verifyConditions" of plugin "@qiwi/semantic-release-gh-pages-plugin"
[7:12:56 PM] [semantic-release] [@qiwi/semantic-release-gh-pages-plugin] » i  verify gh-pages config
[7:12:56 PM] [semantic-release] » √  Completed step "verifyConditions" of plugin "@qiwi/semantic-release-gh-pages-plugin"
  semantic-release:get-last-release found tags: [] +0ms
[7:12:57 PM] [semantic-release] » i  No git tag version found
[7:12:57 PM] [semantic-release] » i  No previous release found, retrieving all commits
[7:12:57 PM] [semantic-release] » i  Found 5 commits since last release
  semantic-release:get-commits Parsed commits: [ { commit: { long: '72da2c219c9ec70e23240d95765585c4d6134994', short: '72da2c2' }, tree: { long: 'fe68f0f44826d68636b13bcfb22732a88453a5c6', short: 'fe68f0f' }, author: { name: 'Jan Killian', email: '...', date: 2019-07-31T16:23:29.000Z }, committer: { name: 'Jan Killian', email: '...', date: 2019-07-31T17:11:38.000Z }, subject: 'chore(build): add yarn release command to create and deploy new release', body: '', hash: '72da2c219c9ec70e23240d95765585c4d6134994', message: 'chore(build): add yarn release command to create and deploy new release', gitTags: '(HEAD -> master, origin/master, origin/HEAD)', committerDate: 2019-07-31T17:11:38.000Z }, { commit: { long: 'd52574f33d7ef6000e43cd7d069fce6169f12e3c', short: 'd52574f' }, tree: { long: 'f56bc814d9fe1766b7b6dce8f8e94edfc575e5ce', short: 'f56bc81' }, author: { name: 'Jan Killian', email: '...', date: 2019-07-31T16:13:43.000Z }, committer: { name: 'Jan Killian', email: '...', date: 2019-07-31T16:13:43.000Z }, subject: 'docs(readme): add environment settings docs', body: '', hash: 'd52574f33d7ef6000e43cd7d069fce6169f12e3c', message: 'docs(readme): add environment settings docs', gitTags: '', committerDate: 2019-07-31T16:13:43.000Z }, { commit: { long: '3cf0230fe66bf86082d54b9b8c5f76942b521f10', short: '3cf0230' }, tree: { long: '312aabe58afb01b2d7789aa305a0034c14f3fc36', short: '312aabe' }, author: { name: 'Jan Killian', email: '...', date: 2019-07-31T14:44:50.000Z }, committer: { name: 'Jan Killian', email: '...', date: 2019-07-31T14:44:50.000Z }, subject: 'chore(project): set project package properties', body: '', hash: '3cf0230fe66bf86082d54b9b8c5f76942b521f10', message: 'chore(project): set project package properties', gitTags: '', committerDate: 2019-07-31T14:44:50.000Z }, { commit: { long: 'd379edb72411b9b70753dc28228e9248481eab4f', short: 'd379edb' }, tree: { long: '2a22022c91647403a3e462a9aaeef0a02fab68f8', short: '2a22022' }, author: { name: 'Jan Killian', email: '...', date: 2019-07-31T14:07:17.000Z }, committer: { name: 'Jan Killian', email: '...', date: 2019-07-31T14:08:24.000Z }, subject: 'fix(security): fix CVE-2019-10744 in lodash<4.17.13 and lodash.template<4.5.0', body: '', hash: 'd379edb72411b9b70753dc28228e9248481eab4f', message: 'fix(security): fix CVE-2019-10744 in lodash<4.17.13 and lodash.template<4.5.0', gitTags: '', committerDate: 2019-07-31T14:08:24.000Z }, { commit: { long: '8d4abde0cebecac9405817e11b4575417b8b90b0', short: '8d4abde' }, tree: { long: 'b566799d6da231e2c1ad24b18fdbe27e959cd0b6', short: 'b566799' }, author: { name: 'Jan Killian', email: '...', date: 2019-07-28T19:37:35.000Z }, committer: { name: 'Jan Killian', email: '...', date: 2019-07-31T14:03:32.000Z }, subject: 'feat(core): create React app with TypeScript support', body: '', hash: '8d4abde0cebecac9405817e11b4575417b8b90b0', message: 'feat(core): create React app with TypeScript support', gitTags: '(0)', committerDate: 2019-07-31T14:03:32.000Z } ] +0ms
[7:12:57 PM] [semantic-release] » i  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  Analyzing commit: chore(build): add yarn release command to create and deploy new release
  semantic-release:commit-analyzer Analyzing with default rules +0ms
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  The commit should not trigger a release
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  Analyzing commit: docs(readme): add environment settings docs
  semantic-release:commit-analyzer Analyzing with default rules +11ms
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  The commit should not trigger a release
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  Analyzing commit: chore(project): set project package properties
  semantic-release:commit-analyzer Analyzing with default rules +6ms
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  The commit should not trigger a release
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  Analyzing commit: fix(security): fix CVE-2019-10744 in lodash<4.17.13 and lodash.template<4.5.0
  semantic-release:commit-analyzer Analyzing with default rules +9ms
  semantic-release:commit-analyzer The rule { type: 'fix', release: 'patch' } match commit with release type 'patch' +0ms [7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  The release type for the commit is patch
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  Analyzing commit: feat(core): create React app with TypeScript support
  semantic-release:commit-analyzer Analyzing with default rules +11ms
  semantic-release:commit-analyzer The rule { type: 'feat', release: 'minor' } match commit with release type 'minor' +14ms
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  The release type for the commit is minor
[7:12:57 PM] [semantic-release] [@semantic-release/commit-analyzer] » i  Analysis of 5 commits complete: minor release
[7:12:57 PM] [semantic-release] » √  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[7:12:57 PM] [semantic-release] » i  There is no previous release, the next release version is 1.0.0
[7:12:57 PM] [semantic-release] » i  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
  semantic-release:release-notes-generator version: '1.0.0' +0ms
  semantic-release:release-notes-generator host: undefined +2ms
  semantic-release:release-notes-generator owner: 'iki' +2ms
  semantic-release:release-notes-generator repository: 'expenses-app-react-ts-gql' +1ms
  semantic-release:release-notes-generator previousTag: undefined +2ms
  semantic-release:release-notes-generator currentTag: 'v1.0.0' +1ms
  semantic-release:release-notes-generator host: 'https://github.com' +3ms
  semantic-release:release-notes-generator host: 'https://github.com' +2ms
  semantic-release:release-notes-generator linkReferences: undefined +2ms
  semantic-release:release-notes-generator issue: 'issues' +3ms
  semantic-release:release-notes-generator commit: 'commit' +5ms
[7:12:58 PM] [semantic-release] » √  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator" [7:12:58 PM] [semantic-release] » i  Start step "prepare" of plugin "@semantic-release/changelog"
[7:12:58 PM] [semantic-release] [@semantic-release/changelog] » i  Create C:\Users\iki\..src\expenses-app-react-ts-gql\CHANGELOG.md
[7:12:58 PM] [semantic-release] » √  Completed step "prepare" of plugin "@semantic-release/changelog"
[7:12:58 PM] [semantic-release] » i  Start step "prepare" of plugin "@semantic-release/git"
  semantic-release:git globed assets: [ 'CHANGELOG.md', 'package.json' ] +0ms
[7:12:58 PM] [semantic-release] [@semantic-release/git] » i  Found 1 file(s) to commit
  semantic-release:git add file to git index {
  stdout: '',
  stderr: '',
  code: 0,
  failed: false,
  killed: false,
  signal: null,
  cmd: 'git add --force --ignore-errors CHANGELOG.md',
  timedOut: false
} +0ms
  semantic-release:git commited files: [ 'CHANGELOG.md' ] +124ms
[7:13:04 PM] [semantic-release] [@semantic-release/git] » i  Prepared Git release: v1.0.0
[7:13:04 PM] [semantic-release] » √  Completed step "prepare" of plugin "@semantic-release/git"
[7:13:04 PM] [semantic-release] » i  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
  semantic-release:release-notes-generator version: '1.0.0' +7s
  semantic-release:release-notes-generator host: undefined +4ms
  semantic-release:release-notes-generator owner: 'iki' +2ms
  semantic-release:release-notes-generator repository: 'expenses-app-react-ts-gql' +1ms
  semantic-release:release-notes-generator previousTag: undefined +2ms
  semantic-release:release-notes-generator currentTag: 'v1.0.0' +2ms
  semantic-release:release-notes-generator host: 'https://github.com' +2ms
  semantic-release:release-notes-generator host: 'https://github.com' +2ms
  semantic-release:release-notes-generator linkReferences: undefined +3ms
  semantic-release:release-notes-generator issue: 'issues' +2ms
  semantic-release:release-notes-generator commit: 'commit' +3ms
[7:13:04 PM] [semantic-release] » √  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator" [7:13:11 PM] [semantic-release] » √  Created tag v1.0.0
[7:13:11 PM] [semantic-release] » i  Start step "publish" of plugin "@qiwi/semantic-release-gh-pages-plugin"
[7:13:11 PM] [semantic-release] [@qiwi/semantic-release-gh-pages-plugin] » i  Publishing docs via gh-pages
[7:13:22 PM] [semantic-release] [@qiwi/semantic-release-gh-pages-plugin] » ×  Publish docs failure ProcessError: To https://github.com/iki/expenses-app-react-ts-gql.git
 * [new branch]      gh-pages -> gh-pages
 * [new tag]         v1.0.1 -> v1.0.1
 ! [rejected]        v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to 'https://[secure]@github.com/iki/expenses-app-react-ts-gql.git'
hint: Updates were rejected because the tag already exists in the remote.

    at ChildProcess.<anonymous> (C:\Users\iki\..src\expenses-app-react-ts-gql\node_modules\gh-pages\lib\git.js:42:16)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  code: 1,
  message: 'To https://github.com/iki/expenses-app-react-ts-gql.git\n' +
    ' * [new branch]      gh-pages -> gh-pages\n' +
    ' * [new tag]         v1.0.1 -> v1.0.1\n' +
    ' ! [rejected]        v1.0.0 -> v1.0.0 (already exists)\n' +
    "error: failed to push some refs to 'https://[secure]@github.com/iki/expenses-app-react-ts-gql.git'\n" +
    'hint: Updates were rejected because the tag already exists in the remote.\n',
  name: 'ProcessError'
}
[7:13:22 PM] [semantic-release] » ×  Failed step "publish" of plugin "@qiwi/semantic-release-gh-pages-plugin"
[7:13:22 PM] [semantic-release] » ×  An error occurred while running semantic-release: ProcessError: To https://github.com/iki/expenses-app-react-ts-gql.git
 * [new branch]      gh-pages -> gh-pages
 * [new tag]         v1.0.1 -> v1.0.1
 ! [rejected]        v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to 'https://[secure]@github.com/iki/expenses-app-react-ts-gql.git'
hint: Updates were rejected because the tag already exists in the remote.

    at ChildProcess.<anonymous> (C:\Users\iki\..src\expenses-app-react-ts-gql\node_modules\gh-pages\lib\git.js:42:16)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  code: 1,
  message: 'To https://github.com/iki/expenses-app-react-ts-gql.git\n' +
    ' * [new branch]      gh-pages -> gh-pages\n' +
    ' * [new tag]         v1.0.1 -> v1.0.1\n' +
    ' ! [rejected]        v1.0.0 -> v1.0.0 (already exists)\n' +
    "error: failed to push some refs to 'https://[secure]@github.com/iki/expenses-app-react-ts-gql.git'\n" +
    'hint: Updates were rejected because the tag already exists in the remote.\n',
  name: 'ProcessError',
  pluginName: '@qiwi/semantic-release-gh-pages-plugin'
}
ProcessError: To https://github.com/iki/expenses-app-react-ts-gql.git
 * [new branch]      gh-pages -> gh-pages
 * [new tag]         v1.0.1 -> v1.0.1
 ! [rejected]        v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to 'https://[secure]@github.com/iki/expenses-app-react-ts-gql.git'
hint: Updates were rejected because the tag already exists in the remote.

    at ChildProcess.<anonymous> (C:\Users\iki\..src\expenses-app-react-ts-gql\node_modules\gh-pages\lib\git.js:42:16)
    at ChildProcess.emit (events.js:203:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  code: 1,
  message: 'To https://github.com/iki/expenses-app-react-ts-gql.git\n' +
    ' * [new branch]      gh-pages -> gh-pages\n' +
    ' * [new tag]         v1.0.1 -> v1.0.1\n' +
    ' ! [rejected]        v1.0.0 -> v1.0.0 (already exists)\n' +
    "error: failed to push some refs to 'https://[secure]@github.com/iki/expenses-app-react-ts-gql.git'\n" +
    'hint: Updates were rejected because the tag already exists in the remote.\n',
  name: 'ProcessError',
  pluginName: '@qiwi/semantic-release-gh-pages-plugin'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

EDIT: Removed my email from parsed commits :)

@antongolub
Copy link
Member

antongolub commented Aug 1, 2019

@iki, thanks for your detailed report. This seems to be what happens:

semantic-release triggers plugins.prepare before plugins.push. That's correct. But @semantic-release/git plugin evaluates git push at the prepare stage, and gh-pages util does the same on thepublish step.

As we can see, both execs use --tag flag, that pushes all local tags to the remote.

Well, we just need to find a place for git pull --tags -f to sync remote tags.

@antongolub antongolub added the bug Something isn't working label Aug 1, 2019
@antongolub antongolub reopened this Aug 1, 2019
qiwibot added a commit that referenced this issue Aug 1, 2019
## [1.10.5](v1.10.4...v1.10.5) (2019-08-01)

### Bug Fixes

* sync remote tags before git push ([8e1ecac](8e1ecac)), closes [#48](#48)
@antongolub
Copy link
Member

antongolub commented Aug 1, 2019

@iki, the patch (1.10.5) is on way. May I ask you to check thsi out?

@antongolub antongolub pinned this issue Aug 1, 2019
@antongolub
Copy link
Member

Verified 1.10.5: patch, test, build log, result

{
"release": {
    "branch": "master",
    "plugins": [
      "@semantic-release/release-notes-generator",
      "@semantic-release/changelog",
      "@semantic-release/git",
      "@semantic-release/npm",
      [
        "@qiwi/semantic-release-gh-pages-plugin",
        {
          "msg": "updated",
          "branch": "gh-pages"
        }
      ]
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants