diff --git a/.github/workflows/db-docs.yml b/.github/workflows/db-docs.yml deleted file mode 100644 index 6c4b28560..000000000 --- a/.github/workflows/db-docs.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: DB documentation generator - -on: - push: - branches: - - "master" - - "stable" - -jobs: - db-docs: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2 - - name: Cancel previous builds - uses: rokroskar/workflow-run-cleanup-action@master - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Extract branch name - run: | - echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Generate DB docs - run: | - bash scripts/db_docs_generator.sh - env: - BRANCH_NAME: "${{ steps.extract_branch.outputs.branch }}" - VULNERABILITY_DOCS_TOKEN: "${{ secrets.VULNERABILITY_DOCS_TOKEN }}" diff --git a/Dockerfile.dbdocs b/Dockerfile.dbdocs deleted file mode 100644 index a9a75d7b9..000000000 --- a/Dockerfile.dbdocs +++ /dev/null @@ -1,3 +0,0 @@ -FROM schemaspy/schemaspy - -ADD /scripts/schemaspy.properties . diff --git a/docker-compose-dbdocs.yml b/docker-compose-dbdocs.yml deleted file mode 100644 index 6301abd17..000000000 --- a/docker-compose-dbdocs.yml +++ /dev/null @@ -1,27 +0,0 @@ -services: - vulnerability_database: - container_name: vulnerability-engine-database - build: - context: ./ - dockerfile: ./database/Dockerfile.centos - image: vulnerability-engine/database:latest - restart: unless-stopped - env_file: - - ./conf/common.env - - ./conf/database.env - ports: - - 5432:5432 - - schema_spy: - container_name: schema-spy - privileged: true - build: - context: . - dockerfile: ./Dockerfile.dbdocs - depends_on: - - vulnerability_database - volumes: - - ./scripts/output:/output - env_file: - - ./conf/database.env - command: java -jar schemaspy.jar diff --git a/renovate.json b/renovate.json index 5556c8829..16ef0f22b 100644 --- a/renovate.json +++ b/renovate.json @@ -18,7 +18,7 @@ "enabled": false }, { - "matchFileNames": ["**/requirements*.txt", "Dockerfile.test", "Dockerfile.dbdocs", "**/grafana/Dockerfile", "**/platform_mock/Dockerfile"], + "matchFileNames": ["**/requirements*.txt", "Dockerfile.test", "**/grafana/Dockerfile", "**/platform_mock/Dockerfile"], "enabled": false }, { diff --git a/scripts/db_docs_generator.sh b/scripts/db_docs_generator.sh deleted file mode 100644 index 61a3f032a..000000000 --- a/scripts/db_docs_generator.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -GIT_DOCS="db_docs" -VE_DB_SCHEMA="ve_db_postgresql.sql" -VE_DB_MASTER="./db_docs/ve_database_master" -VE_DB_STABLE="./db_docs/ve_database_stable" -ORIGINAL_CSUM="dbscript_csum" -DB_DOCS_OUTPUT="output" -TEMP_CSUM="new_csum" - -if [[ "$BRANCH_NAME" != "master" ]] && [[ "$BRANCH_NAME" != "stable" ]] -then - echo "Database schema is updated only on pushes into master/stable." - exit 0 -fi - -if [[ "$VULNERABILITY_DOCS_TOKEN" == "" ]] -then - echo "Cannot find github token for pushing into docs repo." - exit 1 -fi - -echo "Current branch of git: ${BRANCH_NAME}" - -echo "Calculating checksum for ${VE_DB_SCHEMA}" -cd scripts -git clone https://github.com/RedHatInsights/vulnerability-docs.git $GIT_DOCS -sha1sum ../database/schema/$VE_DB_SCHEMA > $TEMP_CSUM -DIFF_RESULT=0 - -if [[ "$BRANCH_NAME" == "stable" ]] -then - diff $TEMP_CSUM $VE_DB_STABLE/$ORIGINAL_CSUM > /dev/null - DIFF_RESULT=$? -else - diff $TEMP_CSUM $VE_DB_MASTER/$ORIGINAL_CSUM > /dev/null - DIFF_RESULT=$? -fi - -if [[ "$DIFF_RESULT" == "1" ]] -then - echo "Commit has new changes in schema, regenerating docs" - echo "Creating output directory for docs" - mkdir $DB_DOCS_OUTPUT - sudo chmod -R 777 $DB_DOCS_OUTPUT - - echo "Starting schemaspy container and creating docs" - cd .. - sudo systemctl stop postgresql.service - docker-compose -f docker-compose-dbdocs.yml up --build schema_spy - - echo "Stopping containers" - docker container stop vulnerability-engine-database - sudo systemctl start postgresql.service - - echo "Moving the schema image" - cd scripts - sudo chmod -R 777 $DB_DOCS_OUTPUT - if [[ "$BRANCH_NAME" == "stable" ]] - then - COMMIT_MESSAGE="Updating VE stable docs for commit $(git rev-parse --short HEAD)" - rm -rf $VE_DB_STABLE/* - mv ./$DB_DOCS_OUTPUT/* $VE_DB_STABLE - mv -f $TEMP_CSUM $VE_DB_STABLE/$ORIGINAL_CSUM - else - COMMIT_MESSAGE="Updating VE master docs for commit $(git rev-parse --short HEAD)" - rm -rf $VE_DB_MASTER/* - mv ./$DB_DOCS_OUTPUT/* $VE_DB_MASTER - mv -f $TEMP_CSUM $VE_DB_MASTER/$ORIGINAL_CSUM - fi - - git config --global user.name "vmaas-bot" - git config --global user.email "40663028+vmaas-bot@users.noreply.github.com" - - GIT_LOCATION="https://vmaas-bot:${VULNERABILITY_DOCS_TOKEN}@github.com/RedHatInsights/vulnerability-docs.git" - - cd $GIT_DOCS - git add . - git commit -m "$COMMIT_MESSAGE" - git push "$GIT_LOCATION" - - cd .. - rm -rf $DB_DOCS_OUTPUT -else - echo "Schema is unchanged, done." - rm $TEMP_CSUM -fi - -rm -rf $GIT_DOCS