Gitlab CI semantic release local branch beta behind the remote one - gitlab

I am using semantic release for handling versioning in my repo. But recently i am facing issues when running the job. I have a beta branch where beta versions are released. But when the changes are added to beta semantic release runs and shows
The local branch beta is behind the remote one, therefore a new version won't be published
Using the debug flag got some more logs
error: failed to push some refs to 'https://username:[secure]#repo_url'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Any idea how this can be resolved

Related

Make Bitbucket pipeline use new package.json version after running npm version patch

I have a Bitbucket pipeline, for a StencilJs project which has a first step where i bump the version number in package.json using npm version patch. This works fine, and i get it pushed back to the repository and all, without problems. Next step in the pipeline, is where i build the StencilJs project. The problem here is that the project is built using the old version number, not the one i bumped it to. So the original version in package.json may be 1.0.3. Step one bumps the version to 1.0.4 and pushes it to repository. I want the next step to build the components using version 1.0.4, but it doesn't. It still uses 1.0.3 when building.
Anyone how knows how i can make the build come out with version 1.0.4?
Kind regards,
Lars
I made it work by putting npm version patch into the same step as where i am doing the build.
The problem is probably that your pipeline keeps running on the commit prior to you tagging and committing back. You could set up another pipeline to do the Stencil build that triggers when a new tag is created.
To avoid infinite loop i had to add [skip-ci] in the version patch commit message
My pipeline look like this:
pipelines:
branches:
master:
- step:
name: Patch version
script:
- 'v=$(npm version -m "%s [skip ci]" patch)'
- 'git push origin ${v}'
- 'git push'

How do I resolve merge conflicts using git rebase?

I want to know how I can resolve merge conflict using git rebase? I use gitlab UI to create merge request. Currently its showing "There are merge conflicts". How to get rid of this error on UI so that the administrator of project merges the "merge request" from UI?
I have new branch called "feature/one" which I am trying to merge into "dev" and ran into conflict issue.
Any help, greatly appreaciated.
If you are alone working on the feature/one, you would rebase it on top of dev locally, resolve the conflict there (meaning locally on your machine) and force push.
That is
git switch feature/one
git rebase dev
# resolve conflicts
git push --force
That would update your merge request automatically.

Changes not showing up in NodeJs/ReactJs apllication running on Heroku?

I have made changes to some css and js file in my Node-React apllication which is deployed on Heroku. But the changes are not showing up when I git add . the project on heroku. ALthough the changes are not coming up when I run the project locally.
Any help would be appreciated on what could be the possible cause on the changes not getting deployed?
You need a few more commands in your deployment workflow.
The git add . command is putting your local changes into staging.
You also need to run git commit -m 'your commit message' in order to commit those local changes to your local git repository.
Next, you need to run git push to push your local repository to the remote repository it is linked with.
Effective use of git is one of the most useful things you can teach yourself as a developer. It will enable you to contribute effectively to a team when the time comes. Here's a good starter article: Basic Git With Examples.

Go.CD - Updating git repo in build pipeline triggers another build

I am trying to update my git repo during the GoCD build. That means that because Go sees another change it triggers another build.
Is it possible to stop the re-triggering of the build?
Background:
I am building and publishing npm packages and I want to automatically increase the prerelease version so I don't have to remember it.
My pipeline looks essentially like this:
npm version prerelease --no-git-tag-version
npm publish
git add package.json
git commit -m "Bump prerelease version"
git push origin
This will update the version in git if the publish succeeds but also triggers another build since Go is polling.
Configure your CD/CI tool to build only when there is a commit to a specified branch or you can probably create a new branch called "pre-release" and configure CD/CI not to build when there is a commit.
Once this configuration is done in the CD/CI tool
npm version prerelease --no-git-tag-version
npm publish
// fetching for other branches
git fetch
// Switching your branch
git checkout pre-release
// Finally committing
git add -m "Your commit message"
git push -u origin pre-release
I hope this works out for you :)
You can configure your stages in your pipeline to be triggered manually, for example, if you where setting up your pipelines as code, in your ${pipeline_name}.gocd.yaml.
- deploy-to-next-stage:
approval: manual <-- You need this!
jobs:
deploy:
tasks:
...
This may help as you could run an automated deploy to a development stage and then manually push successful builds to the next stage (pre-release perhaps). In this way, your builds that worked would not be effected by new builds being triggered by a push to your repo.
Or you could put this on your first stage and your entire pipeline would not be triggered by the push to the repo, but instead by you heading into the GUI and triggering it yourself.

How to "resync" commits in GitLab after fetching from remote repository?

I've created GitLab project by cloning remote repository. During a few days my colleagues pushed their commits to the original repository (not GitLab). Now I did 'git fetch --all' from GitLab repository but commits do not show in GitLab web UI. What should I do to resync GitLab project with its repository? Is there rake task for that? I can't simply recreate the project as we already imported issues from an external source, created labels, milestones, etc.
There is no GitLab feature to fetch the upstream updates. What you did was import an already existing repository, and that is a one time feature.
But you can fetch the upstream updates into your local repository, then push them to GitLab. You'll need to add the orginial/upstream repo as a remote to your local repository by running git remote add upstream {path to original repo}, then fetch the upstream repos by running git fetch upstream, then merge git merge upstream/master, then git push master origin.
GitHub has a decent help section on adding the upstream remote, and doing the merge.
Only the EE version of GitLab has the repository mirroring feature which supports automatically pulling down updates from the import source repository.
If you are using the free CE version, you'll have to manually update or create a custom process.

Resources