Validate .gitlab-ci.yml via POST request

According to this documentation (https://docs.gitlab.com/ce/api/ci/lint.html) it is possible to send a POST request to an endpoint provided by GitLab, that validates a .gitlab-ci.yml file.

I’m trying to utilize this. I wrote a PHPUnit test, read the contents of a .gitlab-ci.yml file and create a POST request with guzzle. But I get 400 Bad Request (content is missing).

  • I also tried it with pure php curl, but had no success either.

I’d appreciate any ideas or help.

This is the PHP test: https://appzap.githost.io/sebastian/typo3-gitlab-ci/blob/master/tests/GitLabCiFileTests.php

See the bottom of this build log for the test result: https://appzap.githost.io/sebastian/typo3-gitlab-ci/builds/131

Hello,

you are missing the content-type. I have created a small check-script (alas in Python), see https://gitlab.com/mfriedenhagen/snippets/snippets/31610#L79

Hello @mfriedenhagen
If you don’t mine still I’m not able to figure out how to deploy my app into my local server whenever I merge my code with master,
for this do I need to setup any config files or ssh keys, or git runner on my server.

What I did still now,

  1. I’ve installed runner in my local machine.
  2. Able to write gitlab-ci.yml file and passing the builds, it’s showing as deployed but it’s not deployed–

Running with gitlab-ci-multi-runner 1.8.1 (a2efdd4)
WARNING: image is not supported by selected executor and shell
WARNING: environment is not supported by selected executor and shell
Using Shell executor…
Running on OSSLIN080…
Fetching changes…
HEAD is now at a834632 just for testing purpose.
Checking out a8346323 as master…
echo "Deploy to staging server" Deploy to staging server git add -A
git stash No local changes to save git pull --rebase origin master
From https://gitlab.com/Bharadhwaj/admin_portal

  • branch master -> FETCH_HEAD
    Current branch HEAD is up to date.
    Build succeeded

Could you please help us how to configure Continous deployment.

Hello Bharadwaja,

I think this is a completely different topic, so please create a new one. You should at least copy your gitlab-ci.yml as well to the post. Regards Mirko