From 3c61cc47be7f94304d02d50af477bc65a1c8bc2d Mon Sep 17 00:00:00 2001 From: Michael Sverdlov Date: Sun, 6 Oct 2024 12:32:32 +0300 Subject: [PATCH 1/3] Improve AI assistant feedback (#2711) --- general/ai/cli.go | 23 ++++++++++++++++------- go.mod | 2 +- go.sum | 8 ++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/general/ai/cli.go b/general/ai/cli.go index ded8a491b..44a62ba6c 100644 --- a/general/ai/cli.go +++ b/general/ai/cli.go @@ -45,12 +45,15 @@ func HowCmd(c *cli.Context) error { } log.Output(coreutils.PrintLink("This AI-powered interface converts natural language inputs into AI-generated JFrog CLI commands.\n" + "For more information about this interface, see https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli/cli-ai\n" + - "NOTE: This is an experimental version and it supports mostly Artifactory and Xray commands.\n")) + "Note: JFrog AI Assistant is in beta and currently supports primarily Artifactory and Xray commands.\n")) // Ask the user to agree to the terms and conditions. If the user does not agree, the command will not proceed. // Ask this only once per JFrog CLI installation, unless the terms are updated. - if agreed, err := handleAiTermsAgreement(); err != nil || !agreed { + if agreed, err := handleAiTermsAgreement(); err != nil { return err + } else if !agreed { + // If the user does not agree to the terms, the command will not proceed. + return reportTermsDisagreement() } for { @@ -82,7 +85,7 @@ func HowCmd(c *cli.Context) error { // If the response is a valid JFrog CLI command, ask the user for feedback. if validResponse { log.Output() - if err = sendFeedback(); err != nil { + if err = handleResponseFeedback(); err != nil { return err } } @@ -100,16 +103,22 @@ func askQuestion(question string) (response string, err error) { } type feedbackBody struct { - IsGoodResponse bool `json:"is_good_response"` + IsGoodResponse bool `json:"is_good_response,omitempty"` + IsAgreedTerms bool `json:"is_agreed_terms,omitempty"` } -func sendFeedback() (err error) { +func handleResponseFeedback() (err error) { isGoodResponse, err := getUserFeedback() if err != nil { - return err + return } _, err = sendRestAPI(feedback, feedbackBody{IsGoodResponse: isGoodResponse}) - return err + return +} + +func reportTermsDisagreement() (err error) { + _, err = sendRestAPI(feedback, feedbackBody{IsAgreedTerms: false}) + return } func getUserFeedback() (bool, error) { diff --git a/go.mod b/go.mod index ff014cfcc..b7f2573cb 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ replace ( ) require ( - github.com/agnivade/levenshtein v1.1.1 + github.com/agnivade/levenshtein v1.2.0 github.com/buger/jsonparser v1.1.1 github.com/docker/docker v27.3.1+incompatible github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1 diff --git a/go.sum b/go.sum index b88569871..78367f978 100644 --- a/go.sum +++ b/go.sum @@ -621,8 +621,8 @@ github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1o github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= -github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= -github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY= +github.com/agnivade/levenshtein v1.2.0/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -703,8 +703,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= +github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI= From 5afa2a525e25ed6bad1bbf83125084bf4f23666f Mon Sep 17 00:00:00 2001 From: Eyal Ben Moshe Date: Sun, 6 Oct 2024 16:47:12 +0300 Subject: [PATCH 2/3] Upgrade go to v1.23.2 (#2713) --- Jenkinsfile | 2 +- build/docker/slim/Dockerfile | 2 +- go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1397513c3..e5ab170a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ node("docker-xxlarge") { repo = 'jfrog-cli' sh 'rm -rf temp' sh 'mkdir temp' - def goRoot = tool 'go-1.23.1' + def goRoot = tool 'go-1.23.2' env.GOROOT="$goRoot" env.PATH+=":${goRoot}/bin:/tmp/node-${nodeVersion}-linux-x64/bin" env.GO111MODULE="on" diff --git a/build/docker/slim/Dockerfile b/build/docker/slim/Dockerfile index 713051960..b5b94cda7 100644 --- a/build/docker/slim/Dockerfile +++ b/build/docker/slim/Dockerfile @@ -1,6 +1,6 @@ ARG repo_name_21 # Remove ${repo_name_21} to pull from Docker Hub. -FROM ${repo_name_21}/jfrog-docker/golang:1.23.1-alpine as builder +FROM ${repo_name_21}/jfrog-docker/golang:1.23.2-alpine as builder ARG image_name=jfrog-cli ARG cli_executable_name WORKDIR /${image_name} diff --git a/go.mod b/go.mod index b7f2573cb..23931156d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jfrog/jfrog-cli -go 1.23.1 +go 1.23.2 replace ( // Should not be updated to 0.2.6 due to a bug (https://github.com/jfrog/jfrog-cli-core/pull/372) From 43a0a92be8bb22685d002f87c3a05c1760378104 Mon Sep 17 00:00:00 2001 From: Eyal Ben Moshe Date: Fri, 11 Oct 2024 14:34:02 +0300 Subject: [PATCH 3/3] Bump ver from 2.70.0 to 2.71.0 (#2719) --- .github/workflows/nugetTests.yml | 21 +++++++++++++++++---- build/npm/v2-jf/package-lock.json | 2 +- build/npm/v2-jf/package.json | 2 +- build/npm/v2/package-lock.json | 2 +- build/npm/v2/package.json | 2 +- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- utils/cliutils/cli_consts.go | 2 +- 8 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nugetTests.yml b/.github/workflows/nugetTests.yml index 13499d3a4..98ca0e586 100644 --- a/.github/workflows/nugetTests.yml +++ b/.github/workflows/nugetTests.yml @@ -1,4 +1,5 @@ name: NuGet Tests + on: push: branches: @@ -8,10 +9,12 @@ on: # Triggers the workflow on labeled PRs only. pull_request_target: types: [ labeled ] + # Ensures that only the latest commit is running for each PR at a time. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }} cancel-in-progress: true + jobs: NuGet-Tests: if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push' @@ -27,16 +30,26 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} + # Install Mono on Ubuntu to run nuget.exe + - name: Install Mono on Ubuntu + if: matrix.os == 'ubuntu' + run: | + sudo apt-get update + sudo apt-get install -y apt-transport-https dirmngr gnupg ca-certificates + sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list + sudo apt-get update + sudo apt-get install -y mono-complete + - name: Install NuGet uses: nuget/setup-nuget@v2 with: - nuget-version: 6.x + nuget-version: '6.x' - - name: Install dotnet + - name: Install .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: "6.x" - + dotnet-version: '6.x' - name: Setup Go with cache uses: jfrog/.github/actions/install-go-with-cache@main diff --git a/build/npm/v2-jf/package-lock.json b/build/npm/v2-jf/package-lock.json index d94369057..8d7af0834 100644 --- a/build/npm/v2-jf/package-lock.json +++ b/build/npm/v2-jf/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.70.0", + "version": "2.71.0", "lockfileVersion": 1 } diff --git a/build/npm/v2-jf/package.json b/build/npm/v2-jf/package.json index fc48bb148..a71e0ad80 100644 --- a/build/npm/v2-jf/package.json +++ b/build/npm/v2-jf/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.70.0", + "version": "2.71.0", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/build/npm/v2/package-lock.json b/build/npm/v2/package-lock.json index 55fd55011..ac7264999 100644 --- a/build/npm/v2/package-lock.json +++ b/build/npm/v2/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2", - "version": "2.70.0", + "version": "2.71.0", "lockfileVersion": 2 } diff --git a/build/npm/v2/package.json b/build/npm/v2/package.json index 82e52323c..87559f762 100644 --- a/build/npm/v2/package.json +++ b/build/npm/v2/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2", - "version": "2.70.0", + "version": "2.71.0", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/go.mod b/go.mod index 23931156d..b7e55fbd3 100644 --- a/go.mod +++ b/go.mod @@ -16,13 +16,13 @@ require ( github.com/docker/docker v27.3.1+incompatible github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1 github.com/jfrog/archiver/v3 v3.6.1 - github.com/jfrog/build-info-go v1.10.1 + github.com/jfrog/build-info-go v1.10.3 github.com/jfrog/gofrog v1.7.6 github.com/jfrog/jfrog-cli-artifactory v0.1.6 - github.com/jfrog/jfrog-cli-core/v2 v2.56.1 + github.com/jfrog/jfrog-cli-core/v2 v2.56.3 github.com/jfrog/jfrog-cli-platform-services v1.3.0 - github.com/jfrog/jfrog-cli-security v1.11.0 - github.com/jfrog/jfrog-client-go v1.47.1 + github.com/jfrog/jfrog-cli-security v1.11.3 + github.com/jfrog/jfrog-client-go v1.47.2 github.com/jszwec/csvutil v1.10.0 github.com/manifoldco/promptui v0.9.0 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 78367f978..fc371d13c 100644 --- a/go.sum +++ b/go.sum @@ -931,8 +931,8 @@ github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+ github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI= github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw= -github.com/jfrog/build-info-go v1.10.1 h1:5nLrpFjbV2zuBdmJXW2nybAz5vyu+qDkOtR7v0ehi8s= -github.com/jfrog/build-info-go v1.10.1/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE= +github.com/jfrog/build-info-go v1.10.3 h1:9nqBdZD6xkuxiOvxg+idZ79QLFWQNuucvKkl8Xb42kw= +github.com/jfrog/build-info-go v1.10.3/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE= github.com/jfrog/froggit-go v1.16.1 h1:FBIM1qevX/ag9unfmpGzfmZ36D8ulOJ+DPTSFUk3l5U= github.com/jfrog/froggit-go v1.16.1/go.mod h1:TEJSzgiV+3D/GVGE8Y6j46ut1jrBLD1FL6WdMdKwwCE= github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s= @@ -941,14 +941,14 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= github.com/jfrog/jfrog-cli-artifactory v0.1.6 h1:bMfJsrLQJw0dZp4nqUf1xOmtY0rpCatW/I5q88x+fhQ= github.com/jfrog/jfrog-cli-artifactory v0.1.6/go.mod h1:jbNb22ebtupcjdhrdGq0VBew2vWG6VUK04xxGNDfynE= -github.com/jfrog/jfrog-cli-core/v2 v2.56.1 h1:+Me+RQx8BYKib+RZLFtGWFftLjEd3NrjVVxJbSYElKU= -github.com/jfrog/jfrog-cli-core/v2 v2.56.1/go.mod h1:+a9VRDizwc+SK2Io6e4Yp8j7hkTeQstQTmNVwrxdh6Q= +github.com/jfrog/jfrog-cli-core/v2 v2.56.3 h1:9ZZ7TGpobk4XShPzrHkRGfpYzs1w0rg7Hqtfg51iNRg= +github.com/jfrog/jfrog-cli-core/v2 v2.56.3/go.mod h1:xL9b2DrH5FemiTuk2bfUBfbQYC/RvpBkPxxV6XxssXs= github.com/jfrog/jfrog-cli-platform-services v1.3.0 h1:IblSDZFBjL7WLRi37Ni2DmHrXJJ6ysSMxx7t41AvyDA= github.com/jfrog/jfrog-cli-platform-services v1.3.0/go.mod h1:Ky4SDXuMeaiNP/5zMT1YSzIuXG+cNYYOl8BaEA7Awbc= -github.com/jfrog/jfrog-cli-security v1.11.0 h1:Zb8GrBt0TLJ2ApA4qFxxslN76jZRxLyWfCLbD7pT+l8= -github.com/jfrog/jfrog-cli-security v1.11.0/go.mod h1:0vBYBP1jztDf5e25Ww3CkQAA1C609CAccz9NJLoSoRk= -github.com/jfrog/jfrog-client-go v1.47.1 h1:VT2v28/usTSP56+i3MC3fgRvZoh6vjRgQgs8xTk+sYU= -github.com/jfrog/jfrog-client-go v1.47.1/go.mod h1:7M/vgei7VGcLjUxwQ/3r9pH3lvDHlt6Q+Gw+YMis/mc= +github.com/jfrog/jfrog-cli-security v1.11.3 h1:6tijXL6vUgPzl7zxOneB0G/7/uvpqAOL6iZDtIwZlzY= +github.com/jfrog/jfrog-cli-security v1.11.3/go.mod h1:E+1bdDoN5isP6loyTRQu2UNdu9S38Hz/zq2LidWmZZI= +github.com/jfrog/jfrog-client-go v1.47.2 h1:Lu+2n4EU+MzNfotV1VOvF/ZQIWsQJg11Z4YSVhumFy0= +github.com/jfrog/jfrog-client-go v1.47.2/go.mod h1:fx2fq5XwZ7e2pzpBB9pXsP8+ZdKLB8g+A6fjGU6F2XI= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jszwec/csvutil v1.10.0 h1:upMDUxhQKqZ5ZDCs/wy+8Kib8rZR8I8lOR34yJkdqhI= diff --git a/utils/cliutils/cli_consts.go b/utils/cliutils/cli_consts.go index 0d8dedb29..bc23e82b1 100644 --- a/utils/cliutils/cli_consts.go +++ b/utils/cliutils/cli_consts.go @@ -4,7 +4,7 @@ import "time" const ( // General CLI constants - CliVersion = "2.70.0" + CliVersion = "2.71.0" ClientAgent = "jfrog-cli-go" // CLI base commands constants: