This commit is contained in:
Eloy Durán 2022-04-04 14:49:42 +02:00
Родитель 84500b77c5
Коммит 6bf44efbba
2 изменённых файлов: 16 добавлений и 9 удалений

Просмотреть файл

@ -9,8 +9,10 @@ variables:
value: production,externalfacing
- name: serviceTreeID
value: 6F8CD842-E117-412F-BAE4-56A3B6166594
- name: adoNpmFeedBaseUrl
value: https://pkgs.dev.azure.com/domoreexp/_apis/packaging/feeds/npm-mirror
- name: adoOrgBaseUrl
value: https://pkgs.dev.azure.com/domoreexp
- name: adoNpmFeedName
value: npm-mirror
jobs:
- job: compliance
@ -56,4 +58,5 @@ jobs:
- template: ./steps/pierce-ado-npm-mirror-cache.yml
parameters:
adoNpmFeedPat: $(adoNpmFeedPat)
adoNpmFeedBaseUrl: $(adoNpmFeedBaseUrl)
adoOrgBaseUrl: $(adoProjectBaseUrl)
adoNpmFeedName: $(adoNpmFeedName)

Просмотреть файл

@ -8,15 +8,19 @@ parameters:
- name: adoNpmFeedPat
type: string
default: "PROVIDE AN ADO NPM FEED PAT THAT HAS CONTRIBUTOR PERMISSION"
# Base URL looks like: https://pkgs.dev.azure.com/[ORG]/_apis/packaging/feeds/[NPM FEED NAME]
- name: adoNpmFeedBaseUrl
- name: adoOrgBaseUrl
type: string
default: "https://pkgs.dev.azure.com/[ORG]"
- name: adoNpmFeedName
type: string
default: "PROVIDE BASE URL TO ADO NPM FEED"
steps:
- bash: |
git diff --name-only HEAD HEAD~1 | grep 'packages/.*/package.json' | while read line ; do
pkgAndVersion=`cat $line | jq -r '. | "\(.name)/versions/\(.version)"'`
curl -Iv -w "%{http_code}" -u $(adoNpmFeedPat) $(adoNpmFeedBaseUrl)/npm/packages/$pkgAndVersion/content || true
git diff --name-only HEAD HEAD~1 | grep 'packages/.*/package.json' | while read pkgFilename ; do
pkgName = `cat $pkgFilename | jq -r '.name'`
pkgVersion = `cat $pkgFilename | jq -r '.version'`
pkgBasename=`echo $pkgAndVersion | cut -d "/" -f 2`
curl -Ivu $(adoNpmFeedPat) $(adoOrgBaseUrl)/_apis/packaging/feeds/$(adoNpmFeedName)/npm/packages/$pkgName/versions/$pkgVersion/content || true
curl -Ivu $(adoNpmFeedPat) $(adoOrgBaseUrl)/_packaging/$(adoNpmFeedName)/npm/registry/$pkgName/-/$pkgBasename-$pkgVersion.tgz || true
done
displayName: "Pierce ADO NPM feed cache"