Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into jf-acce…
Browse files Browse the repository at this point in the history
…ss-token

# Conflicts:
#	go.mod
#	go.sum
  • Loading branch information
RobiNino committed Oct 2, 2023
2 parents 5b80035 + e7241cd commit 96d7688
Show file tree
Hide file tree
Showing 73 changed files with 3,185 additions and 378 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/addReleaseLinks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
RELEASE_VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
# Replace the place-holders '{version}' with the actual release version.
sed "s/{version}/$RELEASE_VERSION/g" ./.github/releaseLinkTemplate.md > ./temp_releaseLinkTemplate.md
sed "s/{version}/$RELEASE_VERSION/g" ./.github/RELEASE_LINK_TEMPLATE.md > ./temp_releaseLinkTemplate.md
- name: Add links to release notes
uses: softprops/action-gh-release@v1
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,15 @@ jobs:
uses: securego/gosec@master
with:
args: -exclude G204,G301,G302,G304,G306 -tests -exclude-dir \.*test\.* ./...

ShellCheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: '*test*'
3 changes: 1 addition & 2 deletions .github/workflows/dockerTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
# We are temporarily downgrading to Go 1.20.5 due to a bug in version 1.20.6 that causes Docker tests to fail.
go-version: 1.20.5
go-version: 1.20.x
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
41 changes: 38 additions & 3 deletions .github/workflows/scriptTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,60 @@ concurrency:
cancel-in-progress: true
jobs:
Scripts-tests:
name: Script tests (${{ matrix.os }})
name: Script tests (${{ matrix.suite.os }})
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
runs-on: ${{ matrix.os }}-latest
suite:
- os: "ubuntu"

- os: "macos"

- os: "windows"
osSuffix: ".exe"
runs-on: ${{ matrix.suite.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Test install CLI - jf
run: sh build/installcli/jf.sh && jf --version

- name: Test install CLI - jfrog
run: sh build/installcli/jfrog.sh && jfrog --version

- name: Test get CLI - jf
run: sh build/getcli/jf.sh && ./jf --version

- name: Test get CLI - jfrog
run: sh build/getcli/jfrog.sh && ./jfrog --version

- name: Test Build CLI - sh
run: |
sh build/build.sh
./jf${{ matrix.suite.osSuffix }} --version
if: ${{ matrix.suite.os != 'windows' }}

- name: Test Build CLI - bat
run: |
build/build.bat
./jf${{ matrix.suite.osSuffix }} --version
if: ${{ matrix.suite.os == 'windows' }}

- name: Test install npm - v2
working-directory: build/npm/v2
run: |
npm install
bin/jfrog${{ matrix.suite.osSuffix }} --version
- name: Test install npm - v2-jf
working-directory: build/npm/v2-jf
run: |
npm install
bin/jf${{ matrix.suite.osSuffix }} --version
2 changes: 0 additions & 2 deletions .github/workflows/xrayTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
runs-on: ${{ matrix.os }}-latest
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
# Run Xray tests with latest Analyzer
JFROG_CLI_ANALYZER_MANAGER_VERSION: "[RELEASE]"
steps:
- name: Install Go
uses: actions/setup-go@v3
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ node("docker") {
repo = 'jfrog-cli'
sh 'rm -rf temp'
sh 'mkdir temp'
def goRoot = tool 'go-1.20.5'
def goRoot = tool 'go-1.20.8'
env.GOROOT="$goRoot"
env.PATH+=":${goRoot}/bin"
env.GO111MODULE="on"
Expand Down
37 changes: 35 additions & 2 deletions artifactory_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"archive/zip"
"bytes"
"crypto/tls"
"encoding/csv"
Expand Down Expand Up @@ -4166,6 +4167,38 @@ func TestUploadDeploymentViewWithArchive(t *testing.T) {
cleanArtifactoryTest()
}

func TestUploadZipAndCheckDeploymentViewWithArchive(t *testing.T) {
initArtifactoryTest(t, "")

// Create tmp dir
assert.NoError(t, os.Mkdir(tests.Out, 0755))
wd, err := os.Getwd()
assert.NoError(t, err)
defer cleanArtifactoryTest()
chdirCallback := clientTestUtils.ChangeDirWithCallback(t, wd, tests.Out)
defer chdirCallback()

// Create file and a zip
fileName := "dummy_file.txt"
zipName := "test.zip"
assert.NoError(t, os.WriteFile(fileName, nil, 0644))

// Upload & download zip file
assert.NoError(t, artifactoryCli.Exec("upload", fileName, path.Join(tests.RtRepo1, zipName), "--archive", "zip"))
assert.NoError(t, artifactoryCli.Exec("download", path.Join(tests.RtRepo1, zipName)))

// Check for time-zone offset for each file in the zip
r, err := zip.OpenReader(zipName)
assert.NoError(t, err)
defer func() { assert.NoError(t, r.Close()) }()
_, sysTimezoneOffset := time.Now().Zone()
for _, file := range r.File {
_, fileTimezoneOffset := file.Modified.Zone()
assert.Equal(t, sysTimezoneOffset, fileTimezoneOffset)
}

}

func TestUploadDetailedSummary(t *testing.T) {
initArtifactoryTest(t, "")
uploadCmd := generic.NewUploadCommand()
Expand Down Expand Up @@ -5601,7 +5634,7 @@ func testProjectInit(t *testing.T, projectExampleName string, technology coreuti
// Copy a simple project in a temp work dir
tmpWorkDir, deleteWorkDir := coretests.CreateTempDirWithCallbackAndAssert(t)
defer deleteWorkDir()
testdataSrc := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), technology.ToString(), projectExampleName)
testdataSrc := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), technology.String(), projectExampleName)
err = biutils.CopyDir(testdataSrc, tmpWorkDir, true, nil)
assert.NoError(t, err)
if technology == coreutils.Go {
Expand All @@ -5619,7 +5652,7 @@ func testProjectInit(t *testing.T, projectExampleName string, technology coreuti
err = platformCli.WithoutCredentials().Exec("project", "init", "--path", tmpWorkDir, "--server-id="+tests.ServerId)
assert.NoError(t, err)
// Validate correctness of .jfrog/projects/$technology.yml
validateProjectYamlFile(t, tmpWorkDir, technology.ToString())
validateProjectYamlFile(t, tmpWorkDir, technology.String())
// Validate correctness of .jfrog/projects/build.yml
validateBuildYamlFile(t, tmpWorkDir)
}
Expand Down
2 changes: 1 addition & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ if [ $# -eq 0 ]
exe_name="$1"
fi

CGO_ENABLED=0 go build -o $exe_name -ldflags '-w -extldflags "-static"' main.go
CGO_ENABLED=0 go build -o "$exe_name" -ldflags '-w -extldflags "-static"' main.go
echo "The $exe_name executable was successfully created."
4 changes: 2 additions & 2 deletions build/chocolatey/v2-jf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ choco pack version=<version>
```

This will create the file _build/chocolatey/jfrog-cli.\<version\>.nupkg which can be
installed with Chcolatey
installed with Chocolatey

```powershell
choco install jfrog-cli.<version>.nupkg
```

See Chocolatey's official documenattion [here](https://chocolatey.org/docs/create-packages)
See Chocolatey's official documentation [here](https://chocolatey.org/docs/create-packages)

[choco-dockerfile-pr]: https://github.com/chocolatey/choco/pull/1153
[choco-dockerfile]: https://github.com/chocolatey/choco/tree/master/docker
Expand Down
4 changes: 2 additions & 2 deletions build/chocolatey/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ choco pack version=<version>
```

This will create the file _build/chocolatey/jfrog-cli.\<version\>.nupkg which can be
installed with Chcolatey
installed with Chocolatey

```powershell
choco install jfrog-cli.<version>.nupkg
```

See Chocolatey's official documenattion [here](https://chocolatey.org/docs/create-packages)
See Chocolatey's official documentation [here](https://chocolatey.org/docs/create-packages)

[choco-dockerfile-pr]: https://github.com/chocolatey/choco/pull/1153
[choco-dockerfile]: https://github.com/chocolatey/choco/tree/master/docker
Expand Down
2 changes: 2 additions & 0 deletions build/deb_rpm/v2-jf/build-scripts/deb-install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

wget -qO - https://releases.jfrog.io/artifactory/api/gpg/key/public | apt-key add -;
echo "deb https://releases.jfrog.io/artifactory/jfrog-debs xenial contrib" | sudo tee -a /etc/apt/sources.list;
apt update;
Expand Down
Loading

0 comments on commit 96d7688

Please sign in to comment.