switch to jq due to inconsistent github formatting

This commit is contained in:
aptalca
2020-05-26 10:48:08 -04:00
parent 1a79295280
commit d29efb71ca
2 changed files with 19 additions and 9 deletions
+5 -1
View File
@@ -15,6 +15,10 @@ env:
- BASEIMAGE="code-server" - BASEIMAGE="code-server"
- MODNAME="powershell" - MODNAME="powershell"
before_install:
- sudo apt-get update
- sudo apt-get -y install jq
jobs: jobs:
include: include:
- stage: PR-BuildImage - stage: PR-BuildImage
@@ -26,7 +30,7 @@ jobs:
if: (NOT (type IN (pull_request))) if: (NOT (type IN (pull_request)))
script: script:
# Set version # Set version
- PS_VERSION=$(curl -sX GET "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | awk '{print substr($1,2); }') - PS_VERSION=$(curl -sX GET "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" | jq -r .tag_name | awk '{print substr($1,2); }')
# Build image # Build image
- docker build --no-cache --build-arg PS_VERSION=${PS_VERSION} -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT} . - docker build --no-cache --build-arg PS_VERSION=${PS_VERSION} -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT} .
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} - docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${PS_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
+14 -8
View File
@@ -4,21 +4,27 @@ ARG PS_VERSION
RUN \ RUN \
apk add --no-cache \ apk add --no-cache \
curl && \ curl \
jq && \
if [ -z ${PS_VERSION+x} ]; then \ if [ -z ${PS_VERSION+x} ]; then \
PS_VERSION=$(curl -sX GET "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" \ PS_VERSION=$(curl -sX GET "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]' | awk '{print substr($1,2); }'); \ | jq -r .tag_name | awk '{print substr($1,2); }'); \
fi && \ fi && \
mkdir -p /root-layer/powershell && \ mkdir -p /root-layer/powershell && \
curl -o \ curl -o \
/root-layer/powershell/powershell_x86_64.tar.gz -L \ /root-layer/powershell/powershell_x86_64.tar.gz -L \
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-x64.tar.gz" && \ "https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-x64.tar.gz" && \
curl -o \ curl -o \
/root-layer/powershell/powershell_armv7l.tar.gz -L \ /root-layer/powershell/powershell_armv7l.tar.gz -L \
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-arm32.tar.gz" && \ "https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-arm32.tar.gz" && \
curl -o \ curl -o \
/root-layer/powershell/powershell_aarch64.tar.gz -L \ /root-layer/powershell/powershell_aarch64.tar.gz -L \
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-arm64.tar.gz" "https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-arm64.tar.gz" && \
echo "******** run basic test to validate tarballs *********" && \
for i in x86_64 armv7l aarch64; do \
mkdir -p "/tmp/${i}"; \
tar xzf "/root-layer/powershell/powershell_${i}.tar.gz" -C "/tmp/${i}"; \
done
COPY root/ /root-layer/ COPY root/ /root-layer/