Get dependency from enterprise repository


(pooja prasanthi) #1

I have built and published the go dependencies to our enterprise artifactory.
Is there an efficient way to get the files from artifactory and use them in test runs?

My dependencies are in jfrog artifactory.
They appear like the following:

   go-local/github.com/davecgh/go-spew/@v/v1.1.1.zip
   go-local/github.com/davecgh/go-spew/@v/v1.1.1.mod

How should I resolve them when I run my tests?

When I set GOPROXY =“value” and tried,

go get github.com/Masterminds/semver

go get github.com/Masterminds/semver: unexpected status (http://stg-repo.org.com/artifactory/github.com/%21masterminds/semver/@v/list): 404 Not Found

How can I go get the pkg from enterprise proxy and execute my tests?

As a temporary hack I am doing:


Then following

cd **$** {TESTDIR}/src

curl -O http://stg-repo.org.com/artifactory/ **$** {pkg}

FIELDS=( **$** (echo **$** {pkg} | awk **'{split($0, arr, /[\/:]*/); for (x in arr) { print arr[x] }}'** ))

INDEX=( **$** (echo **$** {FIELDS[@]/@v//} | cut -d/ -f1 | wc -w | tr -d **' '** ))

PREV_INDEX=$INDEX-1

POST_INDEX=$INDEX+1

FILE= **$** {FIELDS[ **$** {POST_INDEX}]}

unzip **$** {FILE}

FILE= **$** (echo **$** {FILE} | sed -e s/^ **$** {go_local}// -e s/ **$** {zip}//)

SOURCE= **$** (find **$** {TESTDIR}/src -name **$** {FIELDS[ **$** {PREV_INDEX}]}@ **$** {FILE})

DIR= **$** (dirname $SOURCE)

mv $SOURCE **$** {DIR}/ **$** {FIELDS[ **$** {PREV_INDEX}]}

rm -rf **$** {FILE}.zip

Please let me know the correct way of doing it.