From 688f8e9930711c115a56536bcaa36324474be743 Mon Sep 17 00:00:00 2001 From: "spaceBearAmadeus (Alex)" Date: Wed, 30 Oct 2024 18:52:46 -0400 Subject: [PATCH] update test and deploy workflows --- .github/workflows/deploy | 130 ----------------------------------- .github/workflows/deploy.yml | 2 +- .github/workflows/test.yml | 7 -- 3 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 .github/workflows/deploy diff --git a/.github/workflows/deploy b/.github/workflows/deploy deleted file mode 100644 index 931dfed14..000000000 --- a/.github/workflows/deploy +++ /dev/null @@ -1,130 +0,0 @@ -name: CD - -on: - workflow_dispatch: - -jobs: - configure-environment: - runs-on: ubuntu-latest - steps: - # Step 1: Checkout repository - - name: Checkout repository - uses: actions/checkout@v3 - - # Step 2: Log in to GHCR - - name: Log in to GHCR - run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin - - # Step 3: Install Docker Compose - - name: Install Docker Compose - run: | - sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - docker-compose --version # Check if Docker Compose is installed correctly - - - name: Install Python and PyYAML - run: | - sudo apt-get update - sudo apt-get install -y python3 python3-pip - pip install pyyaml - - build-base-image: - needs: configure-environment - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Get base image version - run: | - BASE_VERSION=$(cat ./assets/.BASE_VERSION) - echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV - echo "Base Version: $BASE_VERSION" - - - name: Create gcloud config - run: | - echo "$BIOSIMULATIONS_GCLOUD_CONFIG" > ./assets/.biosimulations.json - env: - BIOSIMULATIONS_GCLOUD_CONFIG: ${{ secrets.BIO_JSON_CONTENT }} - - - name: Build base image - run: | - sudo chmod +x ./assets/scripts/build_base.sh - ./assets/scripts/build_base.sh ${{ env.BASE_VERSION }} - - - name: Push base image to GHCR - run: | - sudo chmod +x ./assets/scripts/push_base.sh - sudo chmod +x ./assets/scripts/push_image.sh - ./assets/scripts/push_base.sh ${{ env.BASE_VERSION }} ${{ secrets.REPO_ADMIN_GH_USERNAME }} - - get-microservice-versions: - needs: build-base-image - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Step 5: Extract API container version - - name: Extract API container version - id: extract_api_version - run: | - API_VERSION=$(python3 .github/parse_container_version.py api) - echo "API_VERSION=$API_VERSION" >> $GITHUB_ENV - echo "API Version: $API_VERSION" - - # Step 6: Extract worker container version - - name: Extract worker container version - id: extract_worker_version - run: | - WORKER_VERSION=$(python3 .github/parse_container_version.py worker) - echo "WORKER_VERSION=$WORKER_VERSION" >> $GITHUB_ENV - echo "WORKER Version: $WORKER_VERSION" - - # Step 7: Debug output of extracted versions - - name: Debug output of extracted versions - run: | - echo "API_VERSION=${{ env.API_VERSION }}" - echo "WORKER_VERSION=${{ env.WORKER_VERSION }}" - - build-microservice-images: - needs: get-microservice-versions - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Step 8: Set up Docker Buildx - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - # Step 9: Build Docker containers with Docker Compose - - name: Build Docker containers with Docker Compose - run: docker-compose build --no-cache - - deploy-microservice-images: - needs: build-microservice-images - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Step 10: Change permissions for push script - - name: Change push script permissions - run: chmod +x ./assets/scripts/push_image.sh - - # Step 11: Deploy API microservice container to GHCR - - name: Deploy API microservice container to GHCR - run: | - ./assets/scripts/push_image.sh compose_api ${{ env.API_VERSION }} - env: - REPO_ADMIN_GH_USERNAME: ${{ secrets.REPO_ADMIN_GH_USERNAME }} - REPO_ADMIN_GHCR_TOKEN: ${{ secrets.REPO_ADMIN_GHCR_TOKEN }} - - # Step 12: Deploy Worker microservice container to GHCR - - name: Deploy worker microservice container to GHCR - run: | - ./assets/scripts/push_image.sh compose_worker ${{ env.WORKER_VERSION }} - env: - REPO_ADMIN_GH_USERNAME: ${{ secrets.REPO_ADMIN_GH_USERNAME }} - REPO_ADMIN_GHCR_TOKEN: ${{ secrets.REPO_ADMIN_GHCR_TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 97b1c050b..0e723c5be 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -103,7 +103,7 @@ jobs: docker-compose --version # Check if Docker Compose is installed correctly - name: Build Docker containers with Docker Compose - run: docker-compose build --no-cache + run: docker-compose build - name: Authorize push script run: chmod +x ./assets/scripts/push_image.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5046e18f2..32d0e8d4c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,13 +11,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - # Step 3: Install Docker Compose - - name: Install Docker Compose - run: | - sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - docker-compose --version # Check if Docker Compose is installed correctly - - name: Get new base image version run: | BASE_VERSION=$(cat ./assets/.BASE_VERSION)