Official Content

If you wish to track changes across your generated objects or Sources, you can add the following job definitions to synchronize them to a Git server.

In order to clone a repository and pull changes:

  - job: CloneOrPull
    steps:
      - script: |
          IF EXIST "$(GIT_BRANCH)" (
            cd $(GIT_BRANCH)
            git checkout $(GIT_BRANCH)
            git pull
          ) ELSE (
            git clone https://$(GIT_USER):$(GIT_PASSWORD)@$(GIT_REPO) $(WORKING_DIR)\$(GIT_BRANCH)
          )
        workingDirectory: $(WORKING_DIR)
        name: CloneOrPull

To push your changes to remote:

  - job: PushToGit
    dependsOn: CloneOrPull
    steps:
      - script: >
          cd $(GIT_BRANCH)

          git checkout $(GIT_BRANCH)

          xcopy /E /I /Y "$(COMMIT_FOLDER)" "$(WORKING_DIR)\$(GIT_BRANCH)\$(DEPLOYMENT_UNIT)"

          git add *
        
          git commit -m "Commit build $(Build.BuildNumber)"

          git push -u origin $(GIT_BRANCH)
        workingDirectory: $(WORKING_DIR)
        name: CommitPush

Variables

The following are specific variable definitions required for the task. See Initial Configuration for the generic variables required.

GIT_USER: string
Username of a Git account with permissions over the existing repository.

GIT_PASSWORD: string
Password or Private Access Token associated with the Git Username. PAT is recommended; add parameter as Secret Variable. Using PAT requires full repository access permissions when generated.

GIT_REPO: string 
HTTPS connection repository URL. Said repository has to be previously initialized. We will be storing the tracked files here.
Example: “dev.azure.com/GeneXusDesa/GeneXusBuild/_git/GeneXusBuild”

GIT_BRANCH: string
Name of the branch for versioning. It has to be previously created.
Example: “main”

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant