upd deploy #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Experiments | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
job_count: | |
description: 'Количество jobs для запуска' | |
required: true | |
type: string | |
env: | |
EXPERIMENT_FOLDER: "experiment_${{ github.run_number }}" | |
jobs: | |
run-experiments: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup SSH | |
uses: webfactory/ssh-agent@v0.8.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Create experiment folder and clone analysis repo | |
run: | | |
# Создаем массив итераций на основе введенного количества jobs | |
iterations_array=$(python3 -c "print('[' + ', '.join(str(x) for x in range(1, ${{ github.event.inputs.job_count }} + 1)) + ']')") | |
# Создаем JSON с итерациями | |
json_content="{\"iterations\": $iterations_array}" | |
# Создаем папку, клонируем репозиторий и затем создаем файл с итерациями | |
ssh -o StrictHostKeyChecking=no benqqa@158.160.181.177 " | |
mkdir -p ${{ env.EXPERIMENT_FOLDER }} && \ | |
cd ${{ env.EXPERIMENT_FOLDER }} && \ | |
git clone https://github.com/Benqqa/analysis-GitOps-solutions.git && \ | |
mkdir -p analysis-GitOps-solutions/data && \ | |
echo '$json_content' > analysis-GitOps-solutions/data/iterations.json | |
" | |
- name: Setup GitHub credentials | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
echo "machine github.com login ${{ secrets.GH_USERNAME }} password ${{ secrets.GH_TOKEN }}" > ~/.netrc | |
- name: Run GitHub experiment | |
run: | | |
git clone https://github.com/Benqqa/nir3-experiment1.git | |
./send-test-jobs.sh ${{ github.event.inputs.job_count }} ${{ env.EXPERIMENT_FOLDER }} | |
- name: Setup GitLab credentials | |
run: | | |
echo "machine gitlab.com login ${{ secrets.GITLAB_USERNAME }} password ${{ secrets.GITLAB_TOKEN }}" > ~/.netrc | |
- name: Run GitLab experiment | |
run: | | |
git clone https://gitlab.com/Benqqa/nir3-experiment1.git | |
./send-test-jobs.sh ${{ github.event.inputs.job_count }} ${{ env.EXPERIMENT_FOLDER }} | |
- name: Setup GitVerse credentials | |
run: | | |
echo "machine gitverse.ru login ${{ secrets.GITVERSE_USERNAME }} password ${{ secrets.GITVERSE_TOKEN }}" > ~/.netrc | |
- name: Run GitVerse experiment | |
run: | | |
git clone https://gitverse.ru/benqqa/nir3-experiment1.git | |
./send-test-jobs.sh ${{ github.event.inputs.job_count }} ${{ env.EXPERIMENT_FOLDER }} |