From ebefdfa7ae0429171d06782966d11dd3d335fe69 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Mon, 18 Sep 2023 08:03:39 +0700 Subject: [PATCH] ci: remove deployment script (#139) * ci: remove deployment script * ci: independently built database (#140) --- .github/workflows/sdks-nightly.yml | 2 +- .github/workflows/sdks-pr.yml | 2 +- .github/workflows/systems-nightly.yml | 92 ++++++++++++--------------- .github/workflows/systems-release.yml | 71 ++++++++++++++++----- docker-compose.yml | 2 +- 5 files changed, 98 insertions(+), 71 deletions(-) diff --git a/.github/workflows/sdks-nightly.yml b/.github/workflows/sdks-nightly.yml index d5c8602..c3c2cf7 100644 --- a/.github/workflows/sdks-nightly.yml +++ b/.github/workflows/sdks-nightly.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.19', '1.20' ] + go: [ '1.19', '1.20', '1.21' ] timeout-minutes: 30 defaults: run: diff --git a/.github/workflows/sdks-pr.yml b/.github/workflows/sdks-pr.yml index 8c334d5..f0717c8 100644 --- a/.github/workflows/sdks-pr.yml +++ b/.github/workflows/sdks-pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.19', '1.20' ] + go: [ '1.19', '1.20', '1.21' ] timeout-minutes: 30 defaults: run: diff --git a/.github/workflows/systems-nightly.yml b/.github/workflows/systems-nightly.yml index 5e76c43..684e2d0 100644 --- a/.github/workflows/systems-nightly.yml +++ b/.github/workflows/systems-nightly.yml @@ -175,6 +175,46 @@ jobs: - name: Build run: dotnet build "Registration.csproj" --no-restore -c Release + build-database: + name: Build Database + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + packages: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-redis + flavor: | + latest=false + tags: | + type=edge + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: "{{defaultContext}}:redis" + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-auth: name: Build Auth runs-on: ubuntu-latest @@ -411,55 +451,3 @@ jobs: env: PESTO_URL: http://localhost:50051/ - deploy: - name: Deploy - runs-on: ubuntu-latest - container: debian:bookworm - timeout-minutes: 120 - needs: - - build-auth - - build-rce - - build-landing - - build-registration - steps: - - name: Install required packages - run: apt-get update && apt-get upgrade -y && apt-get install -y tar gzip curl ssh - - - name: Register SSH key - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_KEY }} - name: id_ed25519 - known_hosts: ${{ secrets.SSH_IP }} - if_key_exists: replace - - - name: SSH Keyscan - run: ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_IP }} >> /root/.ssh/known_hosts - - - name: Pull latest code - run: > - ssh - -i /root/.ssh/id_ed25519 - -p ${{ secrets.SSH_PORT }} - -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} - 'ssh pesto "cd ${{ secrets.SSH_WORKDIR }}/pesto && git pull" ' - - - name: Build Docker images - run: > - ssh - -i /root/.ssh/id_ed25519 - -p ${{ secrets.SSH_PORT }} - -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} - "ssh pesto 'echo ${{ secrets.SSH_PASSWORD }} | sudo -S bash -c '\"'cd ${{ secrets.SSH_WORKDIR }}/pesto && - docker compose pull && - docker compose up -d --pull always registration rce landing auth '\"' ' " - - - name: Clean up docker artifacts - run: > - ssh - -i /root/.ssh/id_ed25519 - -p ${{ secrets.SSH_PORT }} - -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} - "ssh pesto 'echo ${{ secrets.SSH_PASSWORD }} | sudo -S bash -c '\"'docker container prune -f && - docker image prune -f && - docker builder prune -f '\"' ' " diff --git a/.github/workflows/systems-release.yml b/.github/workflows/systems-release.yml index b357a86..de30d0b 100644 --- a/.github/workflows/systems-release.yml +++ b/.github/workflows/systems-release.yml @@ -17,13 +17,13 @@ jobs: permissions: contents: read packages: write - defaults: - run: - working-directory: ./auth steps: - name: Checkout code uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -44,7 +44,46 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v3 with: - context: . + context: "{{defaultContext}}:auth" + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + database: + name: Database + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + packages: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-redis + flavor: | + latest=true + tags: | + type=semver,pattern={{version}} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: "{{defaultContext}}:redis" push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -56,13 +95,13 @@ jobs: permissions: contents: read packages: write - defaults: - run: - working-directory: ./rce steps: - name: Checkout code uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -83,7 +122,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v3 with: - context: . + context: "{{defaultContext}}:rce" push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -95,13 +134,13 @@ jobs: permissions: contents: read packages: write - defaults: - run: - working-directory: ./landing steps: - name: Checkout code uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -122,7 +161,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v3 with: - context: . + context: "{{defaultContext}}:landing" push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -134,13 +173,13 @@ jobs: permissions: contents: read packages: write - defaults: - run: - working-directory: ./registration steps: - name: Checkout code uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -161,7 +200,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v3 with: - context: . + context: "{{defaultContext}}:registration" push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 2ea743f..ca46391 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,7 +68,7 @@ services: - pesto db: - build: ./redis + image: ghcr.io/teknologi-umum/pesto-redis:edge platform: linux/amd64 healthcheck: test: "redis-cli ping | grep PONG"