Source Code
In Devtron, the Source Code configuration is used to specify the repository that contains your scripts, Terraform files, YAML configurations, or other resources. The repository acts as a central location for these files, allowing you to reference and execute them in your job without needing to rewrite the scripts in the Workflow Editor each time.
Who Can Perform This Action?
Users need to have the Admin role or the Super Admin role. Refer the User permissions.
To configure the Source Code, follow these steps:
If the job has just been created, you will be automatically directed to the Configurations page. If not, navigate to the Configurations tab of your job..
Select the Source Code tab from the left sidebar.
Figure 1: Selecting Source Code Under Add Git Repository, select the Git Account from the dropdown menu. You can also select
GitHub Public
from the same dropdown to configure a public repository that does not require authentication.Figure 2: Adding Git Account Enter the Repository URL in the Git Repo
URL
field, corresponding to the selected Git account. IfGitHub Public
is selected, you can enter the URL of any public repository, as no authentication is required.Figure 3: Adding Git Repository Configure the Additional Options for the job as per your requirements.
Click on the Save button to save the changes.
Figure 4: Saving Source Code
Configure Additional Options (optional)
Exclude Specific File/Folder in this Repo
Devtron allows you to exclude specific files or folders from the repository from being included in the job execution. This is particularly useful for avoiding unnecessary files or folders that do not contribute to the job’s tasks that are not relevant to the current job execution.
You can define either exclusion rules or inclusion rules to filter the files and folders, ensuring that only the necessary parts of the repository are used in the job.
Commits that contain only changes to excluded files or folders will be marked as excluded when selecting commits to trigger the job, preventing them from being included in the build.
To define the exclusion or inclusion rules, follow these steps:
Check the Exclude specific file/folder in this repo checkbox.
Figure 5: Excluding Specific File/Folder Enter the exclusion or inclusion rules in the Enter file or folder paths to be included or excluded field.
Sample RulesDescriptionImpact on Commits!README.md
Exclusion of a single file in root folder
Commits containing changes made only in the README.md file will not be shown
!README.md
!index.js
Exclusion of multiple files in root folder
Commits containing changes made only in README.md or/and index.js files will not be shown
README.md
Inclusion of a single file in root folder
Commits containing changes made only in the README.md file will be shown. Rest all will be excluded.
!src/extensions/printer/code2.py
Exclusion of a single file in a folder tree
Commits containing changes made specifically to code2.py file will not be shown
!src/*
Exclusion of a single folder and all its files:
Commits containing changes made specifically to files within the
src
folder will not be shown!README.md
index.js
Exclusion and inclusion of files
Commits containing changes made only in README.md will not be shown, but commits made in the index.js file will be shown. All other commits apart from the aforementioned files will be excluded.
!README.md
README.md
Exclusion and inclusion of conflicting files
If conflicting paths are defined in the rule, the one defined later will be considered. In this case, commits containing changes made only in README.md will be shown.
You may use the Learn how link (as shown below) to understand the syntax of defining an exclusion or inclusion rule.
Figure 6: 'Learn how' Button Since file paths can be long, Devtron supports regex too for writing the paths. To understand it better, you may click the How to use link as shown below.
Figure 7: Regex Support
Set Checkout Path
Devtron allows you to define a custom directory path where the repository will be checked out during job execution. By default, the repository is checked out to the root directory (./). However, you can set a custom path to specify a particular folder within the repository to be accessed and utilized during job execution.
To set the checkout path, follow these steps:
Check the Set checkout path checkbox.
Enter the path to the folder you want to check out from the repository in the Set checkout path field.
Sample pathsDescription./
Checkout the repository to the root directory, i.e., the entire repository itself
./src
Checkout the repository to the src folder
./src/app
Checkout the repository to the app folder inside the src folder
Figure 8: Checkout Path
Pull Submodules Recursively
This checkbox is used for pulling git submodules present in a repo. The submodules will be pulled recursively, and the auth method used for the parent repo will be used for submodules too.
To pull the submodules recursively, check the Pull submodules recursively checkbox.

After configuring Source Code, the next step is to create and configure job pipelines.
Refer to the Workflow editor section to create and configure job pipelines.
Last updated
Was this helpful?