Skip to content
Merged
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
22 changes: 14 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ jobs:
go-version: 1.22

- name: Build
run: go build -o product-catalog-service src/product-catalog/main.go
run: |
cd src/product-catalog
go mod download
go build -o product-catalog-service main.go

- name: unit tests
run: go test src/product-catalog/...
run: |
cd src/product-catalog
go test ./...

code-quality:
runs-on: ubuntu-latest
Expand All @@ -35,8 +40,9 @@ jobs:

- name: Run golangci-lint
run: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run src/product-catalog/...
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.63.4
cd src/product-catalog
golangci-lint run ./...

docker:
runs-on: ubuntu-latest
Expand All @@ -60,9 +66,9 @@ jobs:
uses: docker/build-push-action@v6
with:
context: src/product-catalog
file: Dockerfile
file: src/product-catalog/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/product-catalog:${{github.run_id}}
tags: ${{ secrets.DOCKER_USERNAME }}/product-catalog:${{github.run_id}}


updatek8s:
Expand All @@ -78,15 +84,15 @@ jobs:

- name: Update tag in kubernetes deployment manifest
run: |
sed -i 's/image: .*/image: ${{ secrets.DOCKERHUB_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
run: |
git config --global user.email "[email protected]"
git config --global user.name "Abhishek Veeramalla"
git add kubernetes/productcatalog/deploy.yaml
git commit -m "[CI]: Update product catalog image tag"
git push
git push origin HEAD:main -f



Expand Down
3 changes: 3 additions & 0 deletions src/product-catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,6 @@ func createClient(ctx context.Context, svcAddr string) (*grpc.ClientConn, error)
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
)
}



Loading