From 7fb85df3ac3841872acf21df081da8a558ce0ebf Mon Sep 17 00:00:00 2001 From: Igor Gov Date: Wed, 21 Jul 2021 10:52:37 +0300 Subject: [PATCH 1/4] Add version artifact --- .github/workflows/publish.yml | 8 ++++++++ cli/mizu/telemetry.go | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5beaeb446..b60987ee2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -66,6 +66,14 @@ jobs: COMMIT_HASH=${{ github.sha }} - name: Build and Push CLI run: make push-cli SEM_VER='${{ steps.versioning.outputs.version }}' BUILD_TIMESTAMP='${{ steps.version_parameters.outputs.build_timestamp }}' + - shell: bash + run: | + expr '${{ steps.versioning.outputs.version }}' > version.txt + - name: Upload version artifact + uses: actions/upload-artifact@v2 + with: + name: version + path: version.txt - name: publish uses: ncipollo/release-action@v1 with: diff --git a/cli/mizu/telemetry.go b/cli/mizu/telemetry.go index 91735364b..f0a703866 100644 --- a/cli/mizu/telemetry.go +++ b/cli/mizu/telemetry.go @@ -8,22 +8,26 @@ import ( "net/http" ) -const telemetryUrl = "https://us-east4-up9-prod.cloudfunctions.net/mizu-telemetry" - func ReportRun(cmd string, args interface{}) { if Branch != "main" { rlog.Debugf("reporting only on main branch") return } - argsBytes, _ := json.Marshal(args) - argsMap := map[string]string{"telemetry_type": "mizu_execution", "cmd": cmd, "args": string(argsBytes), "component": "mizu_cli"} + argsMap := map[string]string{ + "telemetry_type": "execution", + "cmd": cmd, + "args": string(argsBytes), + "component": "mizu_cli", + "BuildTimestamp": BuildTimestamp, + "version": SemVer} argsMap["message"] = fmt.Sprintf("mizu %v - %v", argsMap["cmd"], string(argsBytes)) jsonValue, _ := json.Marshal(argsMap) - if resp, err := http.Post(telemetryUrl, "application/json", bytes.NewBuffer(jsonValue)); err != nil { - rlog.Debugf("error sending telemtry err: %v, response %v", err, resp) + if resp, err := http.Post("https://us-east4-up9-prod.cloudfunctions.net/mizu-telemetry", + "application/json", bytes.NewBuffer(jsonValue)); err != nil { + rlog.Debugf("error sending telemetry err: %v, response %v", err, resp) } else { rlog.Debugf("Successfully reported telemetry") } From eb67f76e2b2511ce4301854aae026249d20b8ef3 Mon Sep 17 00:00:00 2001 From: Igor Gov Date: Wed, 21 Jul 2021 11:03:30 +0300 Subject: [PATCH 2/4] . --- .github/workflows/publish.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b60987ee2..0e6f163d2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -66,14 +66,6 @@ jobs: COMMIT_HASH=${{ github.sha }} - name: Build and Push CLI run: make push-cli SEM_VER='${{ steps.versioning.outputs.version }}' BUILD_TIMESTAMP='${{ steps.version_parameters.outputs.build_timestamp }}' - - shell: bash - run: | - expr '${{ steps.versioning.outputs.version }}' > version.txt - - name: Upload version artifact - uses: actions/upload-artifact@v2 - with: - name: version - path: version.txt - name: publish uses: ncipollo/release-action@v1 with: @@ -83,3 +75,10 @@ jobs: tag: ${{ steps.versioning.outputs.version }} prerelease: ${{ github.ref != 'refs/heads/main' }} bodyFile: 'cli/bin/README.md' + - shell: bash + run: echo '${{ steps.versioning.outputs.version }}' >> version.txt + - name: Upload version artifact + uses: actions/upload-artifact@v2 + with: + name: version + path: version.txt From e883358cd629d0029dbcb681e66d74d84aea7a5d Mon Sep 17 00:00:00 2001 From: Igor Gov Date: Wed, 21 Jul 2021 11:05:20 +0300 Subject: [PATCH 3/4] . --- .github/workflows/publish.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0e6f163d2..8de4458db 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -76,9 +76,9 @@ jobs: prerelease: ${{ github.ref != 'refs/heads/main' }} bodyFile: 'cli/bin/README.md' - shell: bash - run: echo '${{ steps.versioning.outputs.version }}' >> version.txt + run: echo '${{ steps.versioning.outputs.version }}' >> version.txt - name: Upload version artifact - uses: actions/upload-artifact@v2 - with: - name: version - path: version.txt + uses: actions/upload-artifact@v2 + with: + name: version + path: version.txt From 360a4ea562058d290d34b06f0863762747e57a1d Mon Sep 17 00:00:00 2001 From: Igor Gov Date: Wed, 21 Jul 2021 11:06:42 +0300 Subject: [PATCH 4/4] . --- cli/mizu/telemetry.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/mizu/telemetry.go b/cli/mizu/telemetry.go index f0a703866..c1ac8fd1c 100644 --- a/cli/mizu/telemetry.go +++ b/cli/mizu/telemetry.go @@ -8,6 +8,8 @@ import ( "net/http" ) +const telemetryUrl = "https://us-east4-up9-prod.cloudfunctions.net/mizu-telemetry" + func ReportRun(cmd string, args interface{}) { if Branch != "main" { rlog.Debugf("reporting only on main branch") @@ -25,7 +27,7 @@ func ReportRun(cmd string, args interface{}) { jsonValue, _ := json.Marshal(argsMap) - if resp, err := http.Post("https://us-east4-up9-prod.cloudfunctions.net/mizu-telemetry", + if resp, err := http.Post(telemetryUrl, "application/json", bytes.NewBuffer(jsonValue)); err != nil { rlog.Debugf("error sending telemetry err: %v, response %v", err, resp) } else {