# Read a file in my JenkinsFile located on the master e.g. readTrusted('pod.yaml')?

**URL:** <https://community.jenkins.io/t/read-a-file-in-my-jenkinsfile-located-on-the-master-e-g-readtrusted-pod-yaml/1608>\
**Category:** Using Jenkins\
**Created:** [February 22, 2022, 7:51am UTC](https://community.jenkins.io/t/read-a-file-in-my-jenkinsfile-located-on-the-master-e-g-readtrusted-pod-yaml/1608 "2022-02-22T07:51:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev-samples](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/dev-samples/32/292_2.png) [@dev-samples](https://community.jenkins.io/u/dev-samples)\
**Post date:** [February 22, 2022, 7:51am UTC](https://community.jenkins.io/t/read-a-file-in-my-jenkinsfile-located-on-the-master-e-g-readtrusted-pod-yaml/1608/1 "2022-02-22T07:51:42Z")

</div>

Right now I read an external podTemplate from a file in my Jenkinsfile with:

```auto
podTemplate(label: podLabel, yaml: readTrusted('pod.yaml')) {
  timestamps {
    node(podLabel) {

      stage('Checkout') {
        checkout scm
      }

      stage('Info') {
        sh 'whoami'  
        container('gradle') {
          sh 'whoami'
        }
      }
    }
  }
}

```

where **pod.yaml** is located in the same repo that is being checked out on the agent.

But is it possible to specify I want to read that file from the master/controller instead so I don’t have to store it in each repo?

I know I can create podTemplates on the master using e.g. JCASC but until then I would like I simple getting started approach where I just read a file from the master - if possible?

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [February 22, 2022, 8:11am UTC](https://community.jenkins.io/t/read-a-file-in-my-jenkinsfile-located-on-the-master-e-g-readtrusted-pod-yaml/1608/2 "2022-02-22T08:11:43Z")

</div>

> [@dev-samples](#):
>
> I know I can create podTemplates on the controller using e.g. JCASC but until then I would like I simple getting started approach where I just read a file from the controller - if possible?

It seems weird to me to purposely try to do a hacky work around for a problem where you know the proper solution.

> [@dev-samples](#):
>
> But is it possible to specify I want to read that file from the controller/controller instead so I don’t have to store it in each repo?

would reading it from a shared library work? The bonus would be that the shared library would be version controlled. You could make a function that returned yaml read via [libraryResource](https://www.jenkins.io/doc/pipeline/steps/workflow-cps-global-lib/#libraryresource-load-a-resource-file-from-a-shared-library)
