From 6cd2ce394fa3d1c7d5491604ce4749220ccb9a61 Mon Sep 17 00:00:00 2001 From: serafettin Date: Sun, 14 Jan 2024 22:16:28 +0100 Subject: [PATCH] Iterate --- .../workflows/api-ci.yaml | 25 +++++++++++-------- .../workflows/indexer-ci.yaml | 15 ++++++----- .../workflows/web-app-ci.yaml | 22 ++++++++++------ 3 files changed, 37 insertions(+), 25 deletions(-) rename api/.github/workflows/build.yaml => .github/workflows/api-ci.yaml (61%) rename indexer/.github/workflows/build.yaml => .github/workflows/indexer-ci.yaml (72%) rename web-app/.github/workflows/build.yaml => .github/workflows/web-app-ci.yaml (69%) diff --git a/api/.github/workflows/build.yaml b/.github/workflows/api-ci.yaml similarity index 61% rename from api/.github/workflows/build.yaml rename to .github/workflows/api-ci.yaml index da83c0d1..66425999 100644 --- a/api/.github/workflows/build.yaml +++ b/.github/workflows/api-ci.yaml @@ -1,9 +1,11 @@ -name: deploy +name: API Build & Deploy on: push: branches: - testnet - dev + paths: + - 'api/**' jobs: main: runs-on: ubuntu-latest @@ -27,14 +29,14 @@ jobs: uses: aws-actions/amazon-ecr-login@v1 - name: Install kubectl - uses: azure/setup-kubectl@v2.0 + uses: azure/setup-kubectl@v2.0 - name: Set kubectl context uses: azure/k8s-set-context@v3 with: - method: kubeconfig - kubeconfig: ${{ secrets.KUBECONFIG }} - context: microk8s + method: kubeconfig + kubeconfig: ${{ secrets.KUBECONFIG }} + context: microk8s - name: Check k8s connection run: kubectl get pods @@ -55,17 +57,18 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Build, tag, and push image to Amazon ECR + working-directory: ./api env: DOCKER_TAG: indexnetwork/web3-api:${{ steps.build-time.outputs.time }} DOCKER_REGISTRY: 236785930124.dkr.ecr.us-east-1.amazonaws.com run: | docker build -t $DOCKER_TAG . - docker tag $DOCKER_TAG $DOCKER_REGISTRY/$DOCKER_TAG - docker push $DOCKER_REGISTRY/$DOCKER_TAG - docker tag $DOCKER_TAG $DOCKER_REGISTRY/indexnetwork/web3-api:latest-${GITHUB_REF#refs/heads/} - docker push $DOCKER_REGISTRY/indexnetwork/web3-api:latest-${GITHUB_REF#refs/heads/} + # docker tag $DOCKER_TAG $DOCKER_REGISTRY/$DOCKER_TAG + # docker push $DOCKER_REGISTRY/$DOCKER_TAG + # docker tag $DOCKER_TAG $DOCKER_REGISTRY/indexnetwork/web3-api:latest-${GITHUB_REF#refs/heads/} + # docker push $DOCKER_REGISTRY/indexnetwork/web3-api:latest-${GITHUB_REF#refs/heads/} - name: Deploy run: |- - kubectl set image deployment/api api=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/web3-api:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} - kubectl set image deployment/consumer consumer=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/web3-api:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} + # kubectl set image deployment/api api=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/web3-api:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} + # kubectl set image deployment/consumer consumer=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/web3-api:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} diff --git a/indexer/.github/workflows/build.yaml b/.github/workflows/indexer-ci.yaml similarity index 72% rename from indexer/.github/workflows/build.yaml rename to .github/workflows/indexer-ci.yaml index 6b7961ab..a288cbf3 100644 --- a/indexer/.github/workflows/build.yaml +++ b/.github/workflows/indexer-ci.yaml @@ -1,9 +1,11 @@ -name: deploy +name: Indexer Build & Deploy on: push: branches: - testnet - dev + paths: + - 'indexer/**' jobs: main: runs-on: ubuntu-latest @@ -55,16 +57,17 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Build, tag, and push image to Amazon ECR + working-directory: ./indexer env: DOCKER_TAG: indexnetwork/llm-indexer:${{ steps.build-time.outputs.time }} DOCKER_REGISTRY: 236785930124.dkr.ecr.us-east-1.amazonaws.com run: | docker build -t $DOCKER_TAG . - docker tag $DOCKER_TAG $DOCKER_REGISTRY/$DOCKER_TAG - docker push $DOCKER_REGISTRY/$DOCKER_TAG - docker tag $DOCKER_TAG $DOCKER_REGISTRY/indexnetwork/llm-indexer:latest-${GITHUB_REF#refs/heads/} - docker push $DOCKER_REGISTRY/indexnetwork/llm-indexer:latest-${GITHUB_REF#refs/heads/} + # docker tag $DOCKER_TAG $DOCKER_REGISTRY/$DOCKER_TAG + # docker push $DOCKER_REGISTRY/$DOCKER_TAG + # docker tag $DOCKER_TAG $DOCKER_REGISTRY/indexnetwork/llm-indexer:latest-${GITHUB_REF#refs/heads/} + # docker push $DOCKER_REGISTRY/indexnetwork/llm-indexer:latest-${GITHUB_REF#refs/heads/} - name: Deploy run: |- - kubectl set image deployment/llm-indexer llm-indexer=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/llm-indexer:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} + # kubectl set image deployment/llm-indexer llm-indexer=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/llm-indexer:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} \ No newline at end of file diff --git a/web-app/.github/workflows/build.yaml b/.github/workflows/web-app-ci.yaml similarity index 69% rename from web-app/.github/workflows/build.yaml rename to .github/workflows/web-app-ci.yaml index 2ab8977b..f64ce681 100644 --- a/web-app/.github/workflows/build.yaml +++ b/.github/workflows/web-app-ci.yaml @@ -1,9 +1,14 @@ -name: deploy +name: Web App Build & Deploy on: push: branches: - - testnet - - dev + - testnet + - dev + paths: + - 'web-app/**' +defaults: + run: + working-directory: ./web-app jobs: main: runs-on: ubuntu-latest @@ -55,16 +60,17 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Build, tag, and push image to Amazon ECR + working-directory: ./web-app env: DOCKER_TAG: indexnetwork/web3-web-app:${{ steps.build-time.outputs.time }} DOCKER_REGISTRY: 236785930124.dkr.ecr.us-east-1.amazonaws.com run: | docker build -t $DOCKER_TAG . - docker tag $DOCKER_TAG $DOCKER_REGISTRY/$DOCKER_TAG - docker push $DOCKER_REGISTRY/$DOCKER_TAG - docker tag $DOCKER_TAG $DOCKER_REGISTRY/indexnetwork/web3-web-app:latest-${GITHUB_REF#refs/heads/} - docker push $DOCKER_REGISTRY/indexnetwork/web3-web-app:latest-${GITHUB_REF#refs/heads/} + # docker tag $DOCKER_TAG $DOCKER_REGISTRY/$DOCKER_TAG + # docker push $DOCKER_REGISTRY/$DOCKER_TAG + # docker tag $DOCKER_TAG $DOCKER_REGISTRY/indexnetwork/web3-web-app:latest-${GITHUB_REF#refs/heads/} + # docker push $DOCKER_REGISTRY/indexnetwork/web3-web-app:latest-${GITHUB_REF#refs/heads/} - name: Deploy run: |- - kubectl set image deployment/frontend frontend=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/web3-web-app:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/} + # kubectl set image deployment/frontend frontend=236785930124.dkr.ecr.us-east-1.amazonaws.com/indexnetwork/web3-web-app:${{ steps.build-time.outputs.time }} --namespace env-${GITHUB_REF#refs/heads/}