Doc
Doc
Doc
https://www.youtube.com/watch?v=jEU4suPzA4w
cd <project path>
git init
git remote add orgin <Git Project Path>
git add.
git branch -M main
git commit -m "initial Commit"
```yaml
stages:
- download
- execute
download_project:
stage: download
script:
- mkdir -p C:/Temp/Myssis # Create the directory if it doesn't exist
- cd C:/Temp/Myssis # Change to the directory where you want to clone the
project
- git clone https://gitlab.com/your-username/your-project.git . # Replace with
your GitLab project URL
tags:
- windows # Tag indicating this job should run on a Windows runner
execute_batch:
stage: execute
script:
- cd C:/Temp/Myssis # Change to the directory where the project is cloned
- script.bat # Execute the batch file
tags:
- windows # Tag indicating this job should run on a Windows runner
dependencies:
- download_project # Ensure download_project job completes before executing
this job
```
### Explanation:
- **Stages**: Define the stages of the pipeline. Here we have two stages:
- `download`: Downloads the project from GitLab.
- `execute`: Executes the batch file.
- **`download_project` Job**:
- **`script`**: Contains commands to be executed in this job.
- `mkdir -p C:/Temp/Myssis`: Creates the directory `C:\Temp\Myssis` if it does
not already exist.
- `cd C:/Temp/Myssis`: Changes the current working directory to `C:\Temp\
Myssis`.
- `git clone https://gitlab.com/your-username/your-project.git .`: Clones the
GitLab project from the specified URL (`https://gitlab.com/your-username/your-
project.git`) into the current directory (`.`). Replace `your-username` with your
GitLab username and `your-project` with your GitLab project name.
- **`tags`**: Specifies the tags for the runner where this job should execute. In
this case, `windows` indicates that this job requires a Windows runner environment.
- **`execute_batch` Job**:
- **`script`**: Contains commands to be executed in this job.
- `cd C:/Temp/Myssis`: Changes the current working directory to `C:\Temp\
Myssis`, where the project is cloned.
- `script.bat`: Executes the batch file named `script.bat` located in `C:\Temp\
Myssis`.
- **`tags`**: Specifies the tags for the runner where this job should execute. In
this case, `windows` indicates that this job requires a Windows runner environment.
- **`dependencies`**: Specifies that this job depends on the `download_project`
job. This ensures that the project is downloaded before attempting to execute the
batch file.
### Notes:
- Ensure that the batch file `script.bat` is present in the root directory of the
cloned project (`C:\Temp\Myssis` in this example).
- Adjust paths and commands (`mkdir`, `git clone`, `cd`, `script.bat`) as necessary
based on your specific project structure and requirements.
This YAML configuration sets up a simple GitLab CI/CD pipeline that downloads a
project from GitLab and then executes a batch file on a Windows runner.
*****************************************************************************
nstall Required Softwares
stages:
- setup_environment
- install_odbc_driver
- sqlcmd_commands
- run_ssis
variables:
ODBC_DRIVER_URL: "URL_TO_ODBC_DRIVER_DOWNLOAD"
ODBC_DRIVER_INSTALLER: "odbc_driver_installer.exe"
SSIS_PACKAGE_PATH: "path/to/your/ssis/package.dtsx"
SQL_SERVER_HOST: "sql_server_host"
SQL_DATABASE: "your_database"
SQL_USERNAME: "sql_username"
SQL_PASSWORD: "sql_password"
SQL_CMD_PATH: "path/to/your/sqlcmd"
SSIS_DEVOPS_PATH: "path/to/your/ssis_devops"
before_script:
# Setup environment variables
- stage: setup_environment
script:
- echo "Setting up environment..."
# Check if SQL_CMD_PATH is not already in PATH
- if [ -d "$SQL_CMD_PATH" ] && [[ ":$PATH:" != *":$SQL_CMD_PATH:"* ]]; then
echo "##vso[task.prependpath]$SQL_CMD_PATH"; fi
# Check if SSIS_DEVOPS_PATH is not already in PATH
- if [ -d "$SSIS_DEVOPS_PATH" ] && [[ ":$PATH:" != *":
$SSIS_DEVOPS_PATH:"* ]]; then echo "##vso[task.prependpath]$SSIS_DEVOPS_PATH"; fi
# SQLCMD Commands
- stage: sqlcmd_commands
script:
- sqlcmd -S $SQL_SERVER_HOST -d $SQL_DATABASE -U $SQL_USERNAME -P
$SQL_PASSWORD -i path/to/your/sql_script.sql
# Replace 'path/to/your/sql_script.sql' with the path to your SQL script
containing SQLCMD commands