Customizing your Harness Project Configuration
Before proceeding, ensure that the Harness Solutions Factory has been deployed into your account
Modify the Harness Project Setup workflow to source from the Custom Template Library
-
Log into your Harness Account and select
Code Repository -
Change your scope to the organization named
Harness Platform Management -
Select the repository -
harness-template-libraryand clone this locally to your machine -
Select the repository -
custom-harness-template-libraryand clone this locally to your machine -
Open both repositories in separate VSCode windows. When prompted, do not click
Reopen in Container. We will do this after the initial copy process -
Locally, in the
harness-template-libraryrepository, find the folder namedharness-project -
Copy the folder to the root of the
custom-harness-template-library -
Prepare the IDP Resource Manager file
- Open the
idp_registration_mgr.yamlin the repositoryharness-template-library - Find the
harness-projectentry- org: Harness_Platform_Management
project: Solutions_Factory
workflows:
- name: harness-project - Open the
idp_registration_mgr.yamlin the repositorycustom-harness-template-library - Paste the above code snippet entry under the
entitieskey.noteYou will need to remove the
[]at the end of this lineentities: []
- Open the
-
Reopen the
custom-harness-template-libraryin the container- On the bottom left corner of VSCode is a blue box
><, click on this icon to open the DevContainers management panel and chooseReopen in Container
- On the bottom left corner of VSCode is a blue box
-
Now we will modify the Harness IDP workflow for the
harness-projecttemplate - open the fileharness-project/.harness/catalog_template.yamlin VSCodenoteThere are account level variables that manage the configuration of the Custom Template Library Connector and Repositories. You can access these variables and adjust them by updating the variable in the Account Settings for the platform.
-
Find and Modify the following
Solutions Factory Detailsparameters to match the following values
template_library_connector:
type: string
default: <+variable.account.custom_template_library_connector>
ui:widget: hidden
template_library_repo:
type: string
default: <+variable.account.custom_template_library_repo>
ui:widget: hidden
template_library_branch:
type: string
default: main
ui:widget: hidden
- Find and Modify the following
Solutions Factory Optionsparameters to match the following values
repo_source:
type: string
# Used to group by source the workspaces for bulk actions
default: custom
ui:widget: hidden
- Save and Commit your changes.
note
For this workshop, we will just commit directly to*
main*. In a different workshop, we will work through a feature branch upgrade process - Push your changes to Harness Code
- Find and Execute the pipeline named
Register Custom IDP Templates:- Navigate to the
Solutions Factoryproject in your Harness Account - Filter your pipelines by typing
idpin the pipeline search bar
noteFor this execution, we will make no changes to the inputs and accept the default details
- Navigate to the
- Navigate to IDP and review the YAML for the workflow
harness-projectnoteIf you would like to verify that the change has been made, you can click the three dots and choose
View Yaml. You should see the following annotations:annotations:
is_harness_official: "False"
source: custom-template-library
created_by: custom - Create a new Project with the name
Custom Project- Wait for the execution to complete.
- Review the IACM Workspace
Lab_Custom-Projectin theSolutions Factoryproject- Select the Configuration Tab
- Notice the Tags
source:customandtype:harness-project - Verify that the Repository Git Connector is
Custom Harness Template Library Repo
Customize your Harness Project template
- Open the
custom-harness-template-libraryin VSCode. Make sure youReopen in Container - Create the file
harness-project/templates/roles/Security_Admins.yaml - Copy the contents from this file
harness-project/templates/roles/permission_sets/Security_Orchestration.yamlinto the new role file created.noteMultiple permissions could be added and interspersed from other permission sets. For the purposes of this exercise, we will just copy the entire set.
- Create the file
harness-project/templates/groups/Security_Champions.yaml - Copy the contents from this file
harness-project/templates/groups/Project_Viewers.yamlinto the new group file created. - Add a new role binding to include our new role.
- role: Security_Admins
resource_group: _all_project_level_resources - Save and commit your changes.
note
For this workshop, we will just commit directly to main. In a different workshop, we will work through a feature branch upgrade process
- Push your changes to Harness Code
- Apply customizations to the custom project
- Navigate to the
Solutions Factoryproject in your Harness Account - Open the IACM Workspaces and select the workspace
Lab_Custom-Project - Click Provision and Run the pipeline
note
This pipeline will require a review to verify the changes to be applied. Based on the changes included, you should see four resources Added
- Approve the change and wait for the pipeline to finish
- Navigate to the
- Navigate to the
Custom Projectproject and look at the new RBAC configuration that was added - Apply the change to all the existing workspaces
- Navigate to the
Solutions Factoryproject in your Harness Account - Filter your pipelines by typing
iacmin the pipeline search bar - Run the pipeline
Bulk Workspace Management- WORKSPACE_SOURCE =
official - WORKSPACE_TYPE =
harness-project - WORKSPACE_STATUS =
any - WORKSPACE_CHANGE_SOURCE =
yes - WORKSPACE_ACTION =
apply
noteThis pipeline will migrate the original two projects created to use our new custom-template-library changes.
- WORKSPACE_SOURCE =
- After the
Bulk Workspace Managementcompletes, it will have started new executions of theProvision Workspacepipeline for each matching IACM Workspace - Approve the changes to the existing workspaces
- Navigate to the
- Verify the changes have been applied.
- The projects should include the new changes
- The Workspaces will now be
source:customand the Repository Git Connector isCustom Harness Template Library Repo