diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e62d0f6033..0dfd1b2e7a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,30 +51,32 @@ jobs: working-directory: src/product-catalog docker: - runs-on: ubuntu-latest + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v4 - needs: build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - steps: - - name: checkout code - uses: actions/checkout@v4 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v4 + with: + context: ./src/product-catalog + file: Dockerfile + push: true + tags: | + kamran112/product-catalog:latest + kamran112/product-catalog:${{ github.run_id }} - - name: Install Docker - uses: docker/setup-buildx-action@v1 - - - name: Login to Docker - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Docker Push - uses: docker/build-push-action@v6 - with: - context: src/product-catalog - file: src/product-catalog/Dockerfile - push: true - tags: ${{ secrets.DOCKER_USERNAME }}/product-catalog:${{github.run_id}} updatek8s: @@ -90,12 +92,12 @@ jobs: - name: Update tag in kubernetes deployment manifest run: | - sed -i "s|image: .*|image: ${{ secrets.DOCKER_USERNAME }}/product-catalog:${{github.run_id}}|" kubernetes/productcatalog/deploy.yaml + sed -i "s |image: .*|image:${{ secrets.DOCKER_USERNAME }}/product-catalog:${{github.run_id}}/' kubernetes/productcatalog/deploy.yaml - - name: Commit and push changes + - name: Commit and push change run: | - git config --global user.email "abhishek@gmail.com" - git config --global user.name "Abhishek Veeramalla" + git config --global user.email "imkam22@gmail.com" + git config --global user.name "mdkamran-stack" git add kubernetes/productcatalog/deploy.yaml git commit -m "[CI]: Update product catalog image tag" git push origin HEAD:main -f diff --git a/src/product-catalog/main.go b/src/product-catalog/main.go index b0af92cdad..b594286b9f 100644 --- a/src/product-catalog/main.go +++ b/src/product-catalog/main.go @@ -322,6 +322,22 @@ func createClient(ctx context.Context, svcAddr string) (*grpc.ClientConn, error) + + + + + + + + + + + + + + + +