Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions src/product-catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@

// GetProduct will fail on a specific product when feature flag is enabled
if p.checkProductFailure(ctx, req.Id) {
msg := fmt.Sprintf("Error: Product Catalog Fail Feature Flag Enabled")

Check failure on line 255 in src/product-catalog/main.go

View workflow job for this annotation

GitHub Actions / code-quality

S1039: unnecessary use of fmt.Sprintf (gosimple)
span.SetStatus(otelcodes.Error, msg)
span.AddEvent(msg)
return nil, status.Errorf(codes.Internal, msg)
Expand Down Expand Up @@ -309,8 +309,8 @@
return failureEnabled
}

func createClient(ctx context.Context, svcAddr string) (*grpc.ClientConn, error) {

Check failure on line 312 in src/product-catalog/main.go

View workflow job for this annotation

GitHub Actions / code-quality

func `createClient` is unused (unused)
return grpc.DialContext(ctx, svcAddr,

Check failure on line 313 in src/product-catalog/main.go

View workflow job for this annotation

GitHub Actions / code-quality

SA1019: grpc.DialContext is deprecated: use NewClient instead. Will be supported throughout 1.x. (staticcheck)
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
)
Expand All @@ -322,6 +322,22 @@






















Expand Down
Loading