Putting your script in the Jenkins configuration is fine, but there is an alternative, the Jenkinsfile. The Jenkinsfile is simply a file in your Git repository that contains the pipeline script you want to run. So, copy the pipeline script and place it in a file named Jenkinsfile (no extension) in the root of your repository and commit it to Git. Now, go to the configuration of your pipeline project and change the definition from Pipeline script to Pipeline script from SCM. You must now pick your SCM, which is Git, and then configure the connection to your repository. This works exactly the same as in freestyle projects. Additionally, there is a Script Path, which defaults to Jenkinsfile and Lightweight checkout, which you can leave checked. Again, save and run the project and, basically, everything will be like before, except your script is now in your repository...
United States
Great Britain
India
Germany
France
Canada
Russia
Spain
Brazil
Australia
Singapore
Hungary
Ukraine
Luxembourg
Estonia
Lithuania
South Korea
Turkey
Switzerland
Colombia
Taiwan
Chile
Norway
Ecuador
Indonesia
New Zealand
Cyprus
Denmark
Finland
Poland
Malta
Czechia
Austria
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Netherlands
Bulgaria
Latvia
South Africa
Malaysia
Japan
Slovakia
Philippines
Mexico
Thailand