Forum Discussion

Petewilson's avatar
Petewilson
Contributor
6 months ago
Solved

Pulling Test Data from a GitLab Repo

At the start of the test i have a data that is pulled from various sources to build the correct environment with the latest exes and data. I have the lastest exes copied from a network location succ...
  • Hassan_Ballan's avatar
    6 months ago

    I would design my pipeline to either pull down from source code repository or from network share all related pieces (automation project, data, binaries, etc...) to set up the environment, than when ready I would execute my automation run.

    If I understand it correctly, you are trying to have TestComplete project during the test run pull down data from GitLab and copy binaries from network drive. In that case you can achieve this using a git clone or git pull command. I have not tried the bellow example.

    function PullFromGitLab() {
      // Create a shell object to run command line operations
      var shell = Sys.OleObject("WScript.Shell");
      
      // Define the local path where the repo should live
      var repoPath = "C:\\TestEnv\\DataRepo";
    
      // Check if the folder exists
      if (aqFileSystem.Exists(repoPath)) {
        // If it does, navigate there and run git pull
        var pullCmd = 'cmd.exe /C cd /d "' + repoPath + '" && git pull';
        Log.Message("Running: " + pullCmd);
        shell.Run(pullCmd, 0, true);
      } else {
        // If not, clone the repo into that directory
        var gitUrl = "https://gitlab.com/yourgroup/yourrepo.git";  // Replace with your actual repo URL
        var cloneCmd = 'cmd.exe /C git clone "' + gitUrl + '" "' + repoPath + '"';
        Log.Message("Running: " + cloneCmd);
        shell.Run(cloneCmd, 0, true);
      }
    }
    

    Note: on the agent or VM, per-configure Git and authentication. Also make sure you're using an HTTPS URL with a personal access token (PAT),
    example: https://oauth2:YOUR_TOKEN@gitlab.com/yourgroup/yourrepo.git

    P.S. if you like my post give a like, and if it solves your problem mark it as a solution.