From 808dab247de1f22823953aaf034cc994effa7b85 Mon Sep 17 00:00:00 2001 From: atomzhong <48663740+atomzhong@users.noreply.github.com> Date: Mon, 3 Apr 2023 16:06:07 +0800 Subject: [PATCH 1/2] feature: optimize polaris-discovery-example/discovery-callee-service, add client-ip return. (#939) --- CHANGELOG.md | 1 + .../service/callee/DiscoveryCalleeController.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c1f8175..97c7eb9fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ # Change Log --- +- [feature: optimize polaris-discovery-example/discovery-callee-service, add client-ip return.](https://github.com/Tencent/spring-cloud-tencent/pull/939) diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java index 7c4d82171..a15336393 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java @@ -35,30 +35,35 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("/discovery/service/callee") public class DiscoveryCalleeController { - private static Logger LOG = LoggerFactory.getLogger(DiscoveryCalleeController.class); + private static final Logger LOG = LoggerFactory.getLogger(DiscoveryCalleeController.class); @Value("${server.port:0}") private int port; + @Value("${spring.cloud.client.ip-address:127.0.0.1}") + private String ip; + /** * Get information of callee. + * * @return information of callee */ @GetMapping("/info") public String info() { - LOG.info("Discovery Service Callee [{}] is called.", port); - return String.format("Discovery Service Callee [%s] is called.", port); + LOG.info("Discovery Service Callee [{}:{}] is called.", ip, port); + return String.format("Discovery Service Callee [%s:%s] is called.", ip, port); } /** * Get sum of two value. + * * @param value1 value 1 * @param value2 value 2 * @return sum */ @GetMapping("/sum") public int sum(@RequestParam int value1, @RequestParam int value2) { - LOG.info("Discovery Service Callee is called and sum is {}.", value1 + value2); + LOG.info("Discovery Service Callee [{}:{}] is called and sum is {}.", ip, port, value1 + value2); return value1 + value2; } } From f82856fda2903668fca0ce55ca2136122b63ecc0 Mon Sep 17 00:00:00 2001 From: Haotian Zhang <928016560@qq.com> Date: Mon, 3 Apr 2023 17:34:29 +0800 Subject: [PATCH 2/2] docs:prevent the release of the final version of the sdk. (#943) --- .github/workflows/snapshot.yml | 19 +++++++++++++++++++ CHANGELOG.md | 1 + 2 files changed, 20 insertions(+) diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 2b2f53701..1809ba7c6 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -10,8 +10,27 @@ on: - greenwich jobs: + check-snapshot: + runs-on: ubuntu-latest + outputs: + IS_SNAPSHOT: ${{ steps.set_output_1.outputs.IS_SNAPSHOT }} + steps: + - name: Checkout codes + uses: actions/checkout@v3 + - name: Check deploy type + id: set_output_1 + run: | + line="$(grep SNAPSHOT pom.xml || true)" + echo $line + if [ -n "$line" ]; then + echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT + else + echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT + fi snapshot: runs-on: ubuntu-latest + needs: check-snapshot + if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }} steps: - name: Checkout codes uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 97c7eb9fa..d6d77de26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,3 +2,4 @@ --- - [feature: optimize polaris-discovery-example/discovery-callee-service, add client-ip return.](https://github.com/Tencent/spring-cloud-tencent/pull/939) +- [docs:prevent the release of the final version of the sdk.](https://github.com/Tencent/spring-cloud-tencent/pull/943)