Trying to check my .gitlab-ci.yml for errors and discovered this through the CI Lint in CI/CD section. The following section throws syntax incorrect even though it's according to https://my.gitlab-instance/help/ci/environments
environment:
name: staging
url: https://staging.example.com
Produces this lint error:
Status: syntax is incorrect
Error: jobs:environment config contains unknown keys: name, url
Even trying to hack away with adding dashes like this
environment:
- name: staging
- url: https://staging.example.com
Which gives this instead
Status: syntax is incorrect
Error: jobs:environment config should be a hash
Any ideas how to do this correct?
The team updated Gitlab instance to latest version and the lint error have since disappeared. No idea if this was the actual fix to the lint error but seemed to be working since then.
Related
I am self-hosting a private Gitlab 15.0.2 on Gentoo using this overlay: https://gitlab.awesome-it.de/overlays/gitlab
It's basically an installation from source (no Omnibus). Now I have also configured a gitlab runner (docker based) and a CI pipeline in one of my projects (a homepage being generated through hugo). The pipeline works fine up the the point where it is supposed to upload the artifact which is currently about 11GB in size.
Initially this gave me an "413 Request Entity Too Large" error, so I raised the artifact size limits in Gitlab and increased the client_max_body_size in Nginx. Now I am seeing this error instead:
Uploading artifacts for successful job
Using docker image sha256:c20c992e5d83348903a6f8d18b4005ed1db893c4f97a61e1cd7a8a06c2989c40 for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper#sha256:edc1bf6ab9e1c7048d054b270f79919eabcbb9cf052b3e5d6f29c886c842bfed ...
Uploading artifacts...
public: found 907 matching files and directories
WARNING: Uploading artifacts as "archive" to coordinator... 404 Not Found id=112 responseStatus=404 Not Found status=404 token=X8QjapaV
WARNING: Retrying... context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "archive" to coordinator... 404 Not Found id=112 responseStatus=404 Not Found status=404 token=X8QjapaV
WARNING: Retrying... context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "archive" to coordinator... 404 Not Found id=112 responseStatus=404 Not Found status=404 token=X8QjapaV
FATAL: invalid argument
ERROR: Job failed: exit code 1
It tries 3 times before eventually giving up. Each attempt takes a few minutes.
I am not seeing any messages related to this in Gitlab's production.log which leaves me a bit stumped. The 404 error code does not seem to make much sense in this context. I have tested the build pipeline by branching and removing lots of content to create a much smaller artifact. The upload works in that branch on first try, so the upload URL must be fine.
Are there any other configuration settings that I need to be aware of? Perhaps some timeout for the upload?
EDIT:
Here's my current .gitlab-ci.yaml to give you better idea of what I am doing. It's rather ugly with those NodeJS dependencies being installed every time the pipeline is run, but that's currently not the issue.
image: cibuilds/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
build:
stage: build
script:
- curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
- sudo bash /tmp/nodesource_setup.sh
- sudo apt update
- sudo apt install nodejs
- npm install autoprefixer postcss-cli
- hugo
artifacts:
paths:
- public
I am planning to add another step to the pipeline for the deployment using rsync over ssh.
I am including a remote .gitlab-ci.yml file
variables:
ENTITY_NAME: $CI_PROJECT_TITLE
include:
remote: 'https://gitlab.com/paulblart/paul_test/-/main/.gitlab-ci.yml'
but checking for it YAML syntax in CI Lint GUI its saying
Included file 'https://gitlab.com/paulblart/paul_test/-/main/.gitlab-ci.yml' does not have valid YAML syntax!
But upon checking the syntax of .gitlab-ci.yml of the remote file its valid. I am not sure whats going on.
I saw a different version of problem in my case, I was trying to set CI/CD configuration file pointing to a different project with relatively longer name of a valid yaml file. I checked the linting, file was yaml but error thrown while attempting to run the pipeline was:
Included file .gitlab-ci-a-very-long-gilabci-file.yml#group/subgroup/pipeline-project does not have YAML extension!
Shortening the name solved it, Gitlab can improve the error messages.
Just adding as I didn't find it on Stackoverflow.
I have workaround for this issue
include:
- project: "my-project-with-yml/project-name"
ref: master
file: "/yml/.gitlab-ci.yaml"
rules: ## Optional, to show the support to **rules**
- if: $variable == "condition "
I was also facing the issue with YAML Error, even though the lint was green.
I had this error come up when I was trying to access a gitlab group which wasn't public, so I didn't have rights to look at the file.
Very uninformative error in that case.
I'm having some issues when trying to use Hashicorp vault template (with terraform to.be.continuous).
Actually when I use it with terraform-vault template I got an error message.
This is a summary of .gitlab-ci.yml
include:
- project: "to-be-continuous/terraform"
ref: "2.4.0"
file: "templates/gitlab-ci-terraform.yml"
# Vault variant
- project: 'to-be-continuous/terraform'
ref: '2.4.0'
file: '/templates/gitlab-ci-terraform-vault.yml'
variables:
VAULT_BASE_URL: "https://vault.secrets.tech.orange/v1"
VAULT_ROLE_ID: $VAULT_ROLE_ID
VAULT_SECRET_ID: $VAULT_SECRET_ID
GCP_MYSECRET: "#url#http://vault-secrets-provider/api/secrets/XXX/gcp/credentials?field=mygcpsecret"
Error Message:
[ERROR] Failed getting secret GCP_MYSECRET:
... Connecting to vault-secrets-provider (127.0.0.1:80)
... wget: server returned error: HTTP/1.1 404 Not Found
I tried without vault template and it works.
Would you please help me with this? Or perhaps, where I can ask for some help?
It turns out you were facing this issue due to a Kubernetes runners limitation.
As stated in GitLab documentation,
Kubernetes runners cannot use several services using the same port
As a result, using the tracking service in addition to another one using the same port (80) fails.
It has now been fixed.
Im using official terraform orb for CircleCi pipelines. I would like to specify path to my terraform code, but the error shows that path doesn't exist. But when I'm going into docker which run that job, that path is available. I don't understand why.
jobs:
- terraform/fmt:
checkout: true
path: 'project/terraform/'
context: terraform
We are on the same page. I have seen this error happening with me before and then without any changes on my side the pipeline started to work again. I think there is a problem on CircleCI
I A have a Puppet module with acceptance tests based on Beaker. The module is working fine and when running locally all the acceptance tests run fine. But when I run the tests on Travis I got the following error in the module execution:
/Stage[main]/Alfred::Services/Service[alfred]: Could not evaluate: undefined method `[]' for nil:NilClass
Alfred is a system service based on upstart that is part of my module.
I am using Puppet 4.3.2. Here is the travis build: https://travis-ci.org/nicopaez/alfred-puppet
Any idea?
Looking at the code, there's a few issues.
One is that the environment variable you're using in Travis doesn't set the Puppet version. You need to add that code to your spec_helper_acceptance.rb:
hosts.each do |host|
install_puppet_on(host,
:puppet => ENV['PUPPET_VERSION'] || '4.3.2',
)
end
Right now it's still installing Puppet 3.8 (the default latest)
For further information on what is actually causing the issues in Travis, I forked your repo and did a build where I enabled the debug and trace options for beaker:
result = apply_manifest(pp, :trace => true, :debug => true)
From this, looking at the Travis build, theres an issue with the git clone exec:
Debug: Exec[clone-repo](provider=posix): Executing 'git clone https://github.com/fiuba/alfred.git /var/www/alfred'
Debug: Executing 'git clone https://github.com/fiuba/alfred.git /var/www/alfred'
Notice: /Stage[main]/Alfred::App/Exec[clone-repo]/returns: fatal: Could not change back to '/root': Permission denied
Error: git clone https://github.com/fiuba/alfred.git /var/www/alfred returned 128 instead of one of [0]
You could fix this by using the vcsrepo module, which performs git clones in an more idempotent way:
vcsrepo { '/var/www/alfred':
ensure => present,
source => 'https://github.com/fiuba/alfred.git',
provider => git,
user => 'deployer',
}
There's a few other fixes, I'm PRing some fixes to your module to fix them, and will add a summary here to the Stack Overflow answer after you've reviewed and merged, as some are significant refactors with a few different approaches.