# What code should be written in GITLAB to execute my JSON file which is stored in the repository

**URL:** <https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066>\
**Category:** Help Hub\
**Tags:** collections, jenkins, gitlab\
**Created:** [July 22, 2021, 12:51pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066 "2021-07-22T12:51:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagrutiwani0](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@jagrutiwani0](https://community.postman.com/u/jagrutiwani0)\
**Post date:** [July 22, 2021, 12:51pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/1 "2021-07-22T12:51:49Z")

</div>

Hi Team,

I have uploaded my collections in the customized **GitLab** with the help of the POSTMAN Teams integration plan.  
I want to write a code in **GitLab** (.yml file) which will help to execute my collections.

Can you help me with writing the code in GITLAB for executing my collections?  
Please find the screenshot for reference

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/1/81897d58a4cea318c194f2d9d5c1edc3f0e2e01a.png)

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [July 22, 2021, 12:56pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/2 "2021-07-22T12:56:39Z")

</div>

Adding something like this in a pipeline yml file should get that running in gitlab:

```auto
stages:
    - test

newman_tests:
    stage: test
    image:
        name: postman/newman
        entrypoint: [""]
    script:
        - newman run ./your_dir/your_collection.json

```

Here’s an example project that I use to demo Newman with Gitlab.

> **[Danny Dainton / postman-ci-pipeline-example](https://gitlab.com/DannyDainton/postman-ci-pipeline-example)**
>
> GitLab.com

---

<div class="post-metadata">

**Author:** ![jagrutiwani0](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@jagrutiwani0](https://community.postman.com/u/jagrutiwani0)\
**Post date:** [July 22, 2021, 12:59pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/3 "2021-07-22T12:59:15Z")

</div>

Hi @danny-dainton ,

Thanks for your quick reply. Will try executing it and will post the results over here.  
Thanks a lot 🙂

Regards,  
Jagruti Wani

---

<div class="post-metadata">

**Author:** ![jagrutiwani0](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@jagrutiwani0](https://community.postman.com/u/jagrutiwani0)\
**Post date:** [October 20, 2021, 7:49am UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/4 "2021-10-20T07:49:53Z")

</div>

Hi @danny-dainton ,

I’m getting the below error-

> newman : The term ‘newman’ is not recognized as the name of a cmdlet, function, script file, or operable program.  
> Check the spelling of the name, or if a path was included, verify that the path is correct and try again.  
> At C:\Windows\TEMP\build\_script216006556\script.ps1:217 char:1

This is the below code, I’m using the gitlab-ci.yml file

> stages:  
> - test  
> newman\_tests:  
> stage: test  
> tags:  
> - ci  
> - ssh  
> image:  
> name: postman/newman  
> entrypoint: [“”]  
> script:  
> - newman --version  
> - newman run ./Postman\_Collections/APIAutomation.json

Thanks and Regards,  
Jagruti Wani

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 21, 2021, 12:00pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/5 "2021-10-21T12:00:22Z")

</div>

What’s does the actual Gitlab file look like? Not the pasted code from it.

---

<div class="post-metadata">

**Author:** ![jagrutiwani0](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@jagrutiwani0](https://community.postman.com/u/jagrutiwani0)\
**Post date:** [October 21, 2021, 12:04pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/6 "2021-10-21T12:04:26Z")

</div>

@dannydainton,

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/f/f1b28d247bcf8d1b766e2831b8fbb8441ebcd818.png)  
Is this what you mean? or do I need to share the complete file?

I’m using **shell** scripting in **gitlab-runner**.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 21, 2021, 12:34pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/7 "2021-10-21T12:34:10Z")

</div>

The file that contains the workflow script GitLab uses, to know what you would like to run.

> I’m using **shell** scripting in **gitlab-runner**.

I don’t know what that means, is that something different to the `.yml` file?

I’m not an expert on all things Gitlab, any knowledge that I have on the CI workflows has come from their documentation.

> **[CI/CD YAML syntax reference | GitLab](https://docs.gitlab.com/ee/ci/yaml/)**
>
> GitLab product documentation.

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [October 21, 2021, 12:58pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/8 "2021-10-21T12:58:47Z")

</div>

> [@jagrutiwani0](#):
>
> I’m using **shell** scripting in **gitlab-runner**.

The pipeline definition provided by @danny-dainton expects you to use a Docker executor, since you have specified a Docker image.

If you don’t wish to use Docker and wish to continue with your shell executor, you need to install all dependencies on your system that runs the GitLab Runner.

I **highly recommend** using Docker. If you are new to GitLab, use the shared runners from [GitLab.com](http://GitLab.com)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 21, 2021, 1:11pm UTC](https://community.postman.com/t/what-code-should-be-written-in-gitlab-to-execute-my-json-file-which-is-stored-in-the-repository/26066/9 "2021-10-21T13:11:21Z")

</div>

I’d 100% listen to @vdespa, he knows what he’s talking about. 🏆
