Loading common-openapi/.gitlab-ci.yml +5 −1 Original line number Diff line number Diff line Loading @@ -83,10 +83,14 @@ Generation of OpenAPI: - git clone "https://oauth2:$AUTOMATED_OPENAPI_GENERATION@$CI_SERVER_HOST/rep/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME} script: - echo 'Generate OpenAPI' - ./generateOpenapi.sh ${CI_PROJECT_NAME} project-config.yaml - ./generateOpenapi.sh ${CI_PROJECT_NAME} project-config.yaml $CI_COMMIT_BRANCH after_script: - version=$(cat version.txt) # Read version from file - cd ${CI_PROJECT_NAME} - | git push --push-option="ci.skip" -u origin "openapi-update-$version" - | git checkout - | git push --push-option="ci.skip" -u origin "openapi-update-$version" # Create merge request using GitLab API Loading common-openapi/generateOpenapi.sh +10 −4 Original line number Diff line number Diff line #!/bin/bash if [ "$#" -ne 2 ]; then echo "Usage: $0 <project-path> <project-config.yaml>" if [ "$#" -ne 3 ]; then echo "Usage: $0 <project-path> <project-config.yaml> <commit-branch>" exit 1 fi Loading Loading @@ -30,7 +30,13 @@ echo "$version" > ../version.txt branch_name="openapi-update-$version" echo "\n------ Creating new branch $branch_name --------" cd ../$1 # Go to cloned repo git checkout -b "$branch_name" #Remove uploaded docx file from default branch git checkout $3 git rm doc/$spec git commit -m "Removing uploaded docx file" git push --push-option="ci.skip" -u origin $3 # Checkout to the existing branch or create it if it does not exist (it does not contain the uploaded docx document) git checkout "$branch_name" || git checkout -b "$branch_name" cd ../doc # Back to root doc directory for processing echo "\n------ Checking for docker image --------" Loading @@ -42,6 +48,7 @@ project_prefix=$(echo $1 | grep -o 'gs[0-9]\{3\}') echo "Project prefix: $project_prefix" echo "Project path: $1" echo "Config file: $2" echo "Branch name: $3" # Get all config files for this project # Extract the section between project prefix and the next project or end of file Loading Loading @@ -110,7 +117,6 @@ done echo "\n------ Prepare to push -------" cd ../$1 # Go to cloned repo for git operations git rm doc/$spec git commit -m "Autogenerated openapi version $version" # Git push and merge request creation are handled by the CI file Loading Loading
common-openapi/.gitlab-ci.yml +5 −1 Original line number Diff line number Diff line Loading @@ -83,10 +83,14 @@ Generation of OpenAPI: - git clone "https://oauth2:$AUTOMATED_OPENAPI_GENERATION@$CI_SERVER_HOST/rep/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME} script: - echo 'Generate OpenAPI' - ./generateOpenapi.sh ${CI_PROJECT_NAME} project-config.yaml - ./generateOpenapi.sh ${CI_PROJECT_NAME} project-config.yaml $CI_COMMIT_BRANCH after_script: - version=$(cat version.txt) # Read version from file - cd ${CI_PROJECT_NAME} - | git push --push-option="ci.skip" -u origin "openapi-update-$version" - | git checkout - | git push --push-option="ci.skip" -u origin "openapi-update-$version" # Create merge request using GitLab API Loading
common-openapi/generateOpenapi.sh +10 −4 Original line number Diff line number Diff line #!/bin/bash if [ "$#" -ne 2 ]; then echo "Usage: $0 <project-path> <project-config.yaml>" if [ "$#" -ne 3 ]; then echo "Usage: $0 <project-path> <project-config.yaml> <commit-branch>" exit 1 fi Loading Loading @@ -30,7 +30,13 @@ echo "$version" > ../version.txt branch_name="openapi-update-$version" echo "\n------ Creating new branch $branch_name --------" cd ../$1 # Go to cloned repo git checkout -b "$branch_name" #Remove uploaded docx file from default branch git checkout $3 git rm doc/$spec git commit -m "Removing uploaded docx file" git push --push-option="ci.skip" -u origin $3 # Checkout to the existing branch or create it if it does not exist (it does not contain the uploaded docx document) git checkout "$branch_name" || git checkout -b "$branch_name" cd ../doc # Back to root doc directory for processing echo "\n------ Checking for docker image --------" Loading @@ -42,6 +48,7 @@ project_prefix=$(echo $1 | grep -o 'gs[0-9]\{3\}') echo "Project prefix: $project_prefix" echo "Project path: $1" echo "Config file: $2" echo "Branch name: $3" # Get all config files for this project # Extract the section between project prefix and the next project or end of file Loading Loading @@ -110,7 +117,6 @@ done echo "\n------ Prepare to push -------" cd ../$1 # Go to cloned repo for git operations git rm doc/$spec git commit -m "Autogenerated openapi version $version" # Git push and merge request creation are handled by the CI file Loading