so I have been trying to push some commits to the GitLab origin, but for some reason, the pipeline is keep failing. Here is the picture.
enter image description here
I created a different branch named scrolling-logo and tried to merge it with the master branch on GitLab using git push origin, but somehow the pipeline is keep showing errors.
I tried git pull to update the master branch to its latest version on my local machine and then again tried to push to the GitLab, but it is still not working.
Does anyone know why this problem occurs?
As noted in a similar issue, make sure your GitLab pipeline does install and use the hugo_extended image, as in pages/hugo .gitlab-ci.yml.
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
# Set this if you intend to use Git submodules
variables:
GIT_SUBMODULE_STRATEGY: recursive
HUGO_ENV: production
default:
before_script:
- apk add --update --no-cache git go
- git submodule update --init --recursive
- hugo mod init gitlab.com/pages/hugo
- hugo mod get -u github.com/theNewDynamic/gohugo-theme-ananke
test:
script:
- hugo
rules:
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
pages:
script:
- hugo
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
That could be enough to avoid this error.
The OP Chin-Erdene Gantulga adds in the comments:
There was this image conflict within the docker so I changed manually the image in the .gitlab-ci.yml from "latest" version to "hugo:0.91.0".
Then it worked.
Related
how can I start a job with gitlab-ci only when I create a new tag with a specific branch?
I try everything but it still doesn't work.
stages:
- shov server
test:
stage: shov server
rules:
- if: '$CI_COMMIT_TAG && $CI_COMMIT_BRANCH == "CI_merge"'
when: always
tags:
- runner
script:
- docker-compose -f docker-compose.yml down
- docker-compose -f docker-compose.yml build
- docker-compose -f docker-compose.yml up -d
AFAIK this is not possible. When the Pipeline runs for a tag, there is no variable defined that indicates the branch. You see this for yourself by looking through all available variables with export. Gitlab Documentation
You could perhaps try to find the branch, which the commit is on. Something like git branch -a --contains $CI_COMMIT_SHA or something similar. However you probably can't do that in the rules, and have to do it in the script, or in the before_script with custom logic to stop the rest of the script from running.
Hope this helps.
I'm trying to create a pipeline on Gitlab CI that increments the app version everytime we get a commit on master. But it is ignoring my ci.skip command and I don't know why.
The yaml file is this one:
.gitlab-ci.yml
workflow:
rules:
- if: $CI_COMMIT_BRANCH == 'master'
before_script:
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
- git remote set-url origin https://push:$PUSH_KEY#$CI_SERVER_HOST/$CI_PROJECT_PATH.git
auto_release:
image: node:10
script:
- yarn
- yarn release
- git push --follow-tags origin HEAD:master -o ci.skip
- echo "Done!"
So everytime I push a new commit it gets locked inside an eternal loop that commits a new version and commits a new version over and over again. The only way to stop is manually cancelling the jobs.
Pleas note: When we use the image node or node:latest it works, but our version requires node:10 otherwise it will break and won't build.
node:10 is a very old image. The git version it contains does not support push options (at least with the shorthand -o), so that's why the push triggers the next CI build.
Check the git version in the image - if it's 2.10 to 2.17 you can use --push-option=ci.skip. If it's still an older version, you need to create your own docker image that contains node version 10 and a modern git version.
I had made a commit in the GitLab branch, then merged it into the main branch, but the .gitlab-ci.yml pipeline is not updating the last committed code into the production server.
Note: Pipeline is working, but committed changes are not visible.
Depend on your version of GitLab, it could be an older bug.
For instance, gitlab-org/gitlab-runner issue 4587 "GitlabRunner does not check out the latest commit but the previous one"
In your gitlab-ci.yml, check what
Workaround:
have same problem, but if use checkout & pull - everything ok
git checkout -f $CI_COMMIT_REF_NAME && git pull
As in, for instance:
script:
- echo $CI_COMMIT_REF_NAME
- git checkout $CI_COMMIT_REF_NAME
- git pull
I had the same issue.
Try turning off the cache in your pipeline and see once
- cache:
software intern here, I want to temporarily change the branch from which we build and deploy our dev, I want to set it from master to i.e. branch1. So far I've changed the default branch in the GitLab repo from master to branch1 and here is how our .gitlab-ci.yml looks like:
build:dev:
stage: build
only:
- branch1
tags:
- project-dev
script:
- docker-compose build
deploy:dev:
stage: deploy
only:
- branch1
tags:
- project-dev
script:
- docker-compose stop server
- docker-compose run server mix ecto.migrate
- docker-compose up -d
upload-to-testfairy:
stage: build
only:
- branch1
tags:
- project-simulant
script:
<doesn't really matter I guess>
I thought this would be enough, but no new jobs seem to be triggered and I can't find a way to trigger them manually either. Thanks in advance.
Ops, my bad, turns out I hadn't updated the yml file in branch1 and it still waited for changes in master in order to build and deploy, after I updated the file in branch1 it automatically started building that commit in branch1.
There is such task in my .gitlab-ci.yml
deploy_all:
stage: deploy
script:
- cp project/target/jnlp/* html/jnlp/
tags:
- client:deploy-all
Everything works fine except unnecessary git repository fetching. Below is extract from runner's log
Running with gitlab-ci-multi-runner 9.1.0 (0118d89)
...
Fetching changes...
HEAD is now at 8dfc104 Update .gitlab-ci.yml
...
Job succeeded
The repository is not needed here because I need only artifacts from other tasks. Is it possible to disable this behaviour?
I found the solution:
upgraded gitlab to version 10.x, manual is here https://docs.gitlab.com/runner/install/linux-repository.html
disabled git checkout in the build script (by adding variables)
deploy_all:
variables:
GIT_STRATEGY: none
GIT_CHECKOUT: "false"
stage: deploy
script:
- cp project/target/jnlp/* html/jnlp/
tags:
- client:deploy-all