diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index cf25adf..2cc36ad 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -26,6 +26,7 @@ env: PUSH_GHCR: ${{ github.repository == (github.event.pull_request.head.repo.full_name || github.repository) && '1' || '' }} PUSH_QUAY: ${{ secrets.QUAY_USER && secrets.QUAY_TOKEN && '1' || '' }} PUSH_DOCKER_HUB: ${{ secrets.DOCKER_USER && secrets.DOCKER_TOKEN && '1' || '' }} + LATEST_TAG: 22.04 defaults: run: @@ -34,6 +35,7 @@ defaults: jobs: build-base: name: Build base ${{ matrix.TAG }} + if: "!contains(github.event.pull_request.body, '[skip build-base]')" runs-on: ubuntu-latest env: PLATFORMS: ${{ matrix.PLATFORMS }} @@ -44,7 +46,6 @@ jobs: PLATFORMS: - linux/amd64,linux/arm64,linux/arm/v7 TAG: - - latest - 22.04 - 20.04 steps: @@ -77,7 +78,7 @@ jobs: - name: Set Ubuntu version to RELEASE run: | - if [ "latest" = "${{ matrix.TAG }}" ]; then + if [ "$LATEST_TAG" = "${{ matrix.TAG }}" ]; then echo "RELEASE_TAG=$(lsb_release -rs)" | tee -a "$GITHUB_ENV" else echo "RELEASE_TAG=${{ matrix.TAG }}" | tee -a "$GITHUB_ENV" @@ -92,39 +93,89 @@ jobs: shell: buildah unshare pwsh "{0}" env: RUNNER: root - TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }} + TAG: act-${{ matrix.TAG }} + LATEST_TAG: act-latest TYPE: act FROM_IMAGE: buildpack-deps FROM_TAG: ${{ env.RELEASE_TAG }} BUILD_TAG_VERSION: ${{ env.PART_TAG }} BUILD_TAG: act-${{ matrix.TAG }} + PUSH_LATEST: ${{ env.LATEST_TAG == matrix.TAG && '1' || '' }} + PUSH_DEFAULT: ${{ ( github.event_name != 'pull_request' && github.event_name != 'push' && !env.ACT ) && '1' || '' }} run: | + $tags = @() + $tagNames = @( "$env:TAG-$env:PART_TAG" ) + if($env:PUSH_LATEST) { + $tagNames += "$env:LATEST_TAG-$env:PART_TAG" + } + if($env:PUSH_DEFAULT) { + $tagNames += $env:TAG + if($env:PUSH_LATEST) { + $tagNames += $env:LATEST_TAG + } + } + + foreach($tagName in $tagNames) { + if($env:PUSH_GHCR) { + $tags += "ghcr.io/${env:SLUG}:$tagName" + } + if($env:PUSH_QUAY) { + $tags += "quay.io/${env:SLUG}:$tagName" + } + if($env:PUSH_DOCKER_HUB) { + $tags += "docker.io/${env:SLUG}:$tagName" + } + } + + echo $tags + ./build.ps1 ` -push ` - -tags @( - ${{ env.PUSH_GHCR && format('''ghcr.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_QUAY || env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_QUAY && format('''quay.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_DOCKER_HUB && format('''docker.io/{0}:{1}''{2}', env.SLUG, env.TAG, ('') && ',' || '') || '' }} - ) + -tags $tags - name: Build and push ${{ env.DISTRO }}:${{ env.TAG }} shell: buildah unshare pwsh "{0}" env: RUNNER: runner - TAG: runner-${{ matrix.TAG }}-${{ env.PART_TAG }} + TAG: runner-${{ matrix.TAG }} + LATEST_TAG: runner-latest TYPE: runner FROM_IMAGE: ghcr.io/${{ env.SLUG }} FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }} BUILD_TAG_VERSION: ${{ env.PART_TAG }} BUILD_TAG: runner-${{ matrix.TAG }} + PUSH_LATEST: ${{ env.LATEST_TAG == matrix.TAG && '1' || '' }} + PUSH_DEFAULT: ${{ ( github.event_name != 'pull_request' && github.event_name != 'push' && !env.ACT ) && '1' || '' }} run: | + $tags = @() + $tagNames = @( "$env:TAG-$env:PART_TAG" ) + if($env:PUSH_LATEST) { + $tagNames += "$env:LATEST_TAG-$env:PART_TAG" + } + if($env:PUSH_DEFAULT) { + $tagNames += $env:TAG + if($env:PUSH_LATEST) { + $tagNames += $env:LATEST_TAG + } + } + + foreach($tagName in $tagNames) { + if($env:PUSH_GHCR) { + $tags += "ghcr.io/${env:SLUG}:$tagName" + } + if($env:PUSH_QUAY) { + $tags += "quay.io/${env:SLUG}:$tagName" + } + if($env:PUSH_DOCKER_HUB) { + $tags += "docker.io/${env:SLUG}:$tagName" + } + } + + echo $tags + ./build.ps1 ` -push ` - -tags @( - ${{ env.PUSH_GHCR && format('''ghcr.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_QUAY || env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_QUAY && format('''quay.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_DOCKER_HUB && format('''docker.io/{0}:{1}''{2}', env.SLUG, env.TAG, ('') && ',' || '') || '' }} - ) + -tags $tags - if: ${{ !env.SKIP_TEST }} uses: actions/setup-go@v3 @@ -144,47 +195,9 @@ jobs: cd act/ go test ./... - - name: Build and push ${{ env.DISTRO }}:${{ env.TAG }} - if: ${{ ( github.event_name != 'pull_request' && github.event_name != 'push' && !env.ACT ) }} - shell: buildah unshare pwsh "{0}" - env: - TAG: act-${{ matrix.TAG }} - TYPE: act - FROM_IMAGE: buildpack-deps - FROM_TAG: ${{ env.RELEASE_TAG }} - BUILD_TAG_VERSION: ${{ env.PART_TAG }} - BUILD_TAG: act-${{ matrix.TAG }} - run: | - ./build.ps1 ` - ${{ '-push' || '' }} ` - -tags @( - ${{ env.PUSH_GHCR && format('''ghcr.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_QUAY || env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_QUAY && format('''quay.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_DOCKER_HUB && format('''docker.io/{0}:{1}''{2}', env.SLUG, env.TAG, ('') && ',' || '') || '' }} - ) - - - name: Build and push ${{ env.DISTRO }}:${{ env.TAG }} - if: ${{ ( github.event_name != 'pull_request' && github.event_name != 'push' && !env.ACT ) }} - shell: buildah unshare pwsh "{0}" - env: - RUNNER: runner - TAG: runner-${{ matrix.TAG }} - TYPE: runner - FROM_IMAGE: ghcr.io/${{ env.SLUG }} - FROM_TAG: act-${{ matrix.TAG }} - BUILD_TAG_VERSION: ${{ env.PART_TAG }} - BUILD_TAG: runner-${{ matrix.TAG }} - run: | - ./build.ps1 ` - -push ` - -tags @( - ${{ env.PUSH_GHCR && format('''ghcr.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_QUAY || env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_QUAY && format('''quay.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_DOCKER_HUB && format('''docker.io/{0}:{1}''{2}', env.SLUG, env.TAG, ('') && ',' || '') || '' }} - ) - build-flavours: name: Build ${{ matrix.TYPE }}:${{ matrix.TAG }} + if: (!cancelled() && !failure()) runs-on: ubuntu-latest needs: [build-base] env: @@ -196,18 +209,31 @@ jobs: max-parallel: 8 matrix: TAG: - - latest - 22.04 - 20.04 - PLATFORMS: - - 'linux/amd64' TYPE: - go - js - pwsh - rust - dotnet + - java-tools - custom + include: + - PLATFORMS: linux/amd64,linux/arm64 + TYPE: go + - PLATFORMS: linux/amd64,linux/arm64 + TYPE: js + - PLATFORMS: linux/amd64,linux/arm64 + TYPE: pwsh + - PLATFORMS: linux/amd64 + TYPE: rust + - PLATFORMS: linux/amd64,linux/arm64 + TYPE: dotnet + - PLATFORMS: linux/amd64,linux/arm64 + TYPE: java-tools + - PLATFORMS: linux/amd64,linux/arm64 + TYPE: custom steps: - name: Cleanup run: | @@ -245,7 +271,7 @@ jobs: - name: Set Ubuntu version to RELEASE run: | - if [ "latest" = "${{ matrix.TAG }}" ]; then + if [ "$LATEST_TAG" = "${{ matrix.TAG }}" ]; then echo "RELEASE_TAG=$(lsb_release -rs)" | tee -a "$GITHUB_ENV" else echo "RELEASE_TAG=${{ matrix.TAG }}" | tee -a "$GITHUB_ENV" @@ -253,38 +279,48 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 - uses: actions/checkout@v3 - name: Build and push ${{ env.DISTRO }}:${{ env.TAG }} shell: buildah unshare pwsh "{0}" - env: - TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }}-${{ env.PART_TAG }} - FROM_IMAGE: ghcr.io/${{ env.SLUG }} - FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }} - BUILD_TAG_VERSION: ${{ env.PART_TAG }} - run: | - ./build.ps1 ` - -push ` - -tags @( - ${{ env.PUSH_GHCR && format('''ghcr.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_QUAY || env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_QUAY && format('''quay.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_DOCKER_HUB && format('''docker.io/{0}:{1}''{2}', env.SLUG, env.TAG, ('') && ',' || '') || '' }} - ) - - - name: Build and push ${{ env.DISTRO }}:${{ env.TAG }} - shell: buildah unshare pwsh "{0}" - if: ${{ ( github.event_name != 'pull_request' && github.event_name != 'push' && !env.ACT ) }} env: TAG: ${{ matrix.TYPE }}-${{ matrix.TAG }} + LATEST_TAG: ${{ matrix.TYPE }}-latest FROM_IMAGE: ghcr.io/${{ env.SLUG }} FROM_TAG: act-${{ matrix.TAG }}-${{ env.PART_TAG }} BUILD_TAG_VERSION: ${{ env.PART_TAG }} + PUSH_LATEST: ${{ env.LATEST_TAG == matrix.TAG && '1' || '' }} + PUSH_DEFAULT: ${{ ( github.event_name != 'pull_request' && github.event_name != 'push' && !env.ACT ) && '1' || '' }} run: | + $tags = @() + $tagNames = @( "$env:TAG-$env:PART_TAG" ) + if($env:PUSH_LATEST) { + $tagNames += "$env:LATEST_TAG-$env:PART_TAG" + } + if($env:PUSH_DEFAULT) { + $tagNames += $env:TAG + if($env:PUSH_LATEST) { + $tagNames += $env:LATEST_TAG + } + } + + foreach($tagName in $tagNames) { + if($env:PUSH_GHCR) { + $tags += "ghcr.io/${env:SLUG}:$tagName" + } + if($env:PUSH_QUAY) { + $tags += "quay.io/${env:SLUG}:$tagName" + } + if($env:PUSH_DOCKER_HUB) { + $tags += "docker.io/${env:SLUG}:$tagName" + } + } + + echo $tags + ./build.ps1 ` -push ` - -tags @( - ${{ env.PUSH_GHCR && format('''ghcr.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_QUAY || env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_QUAY && format('''quay.io/{0}:{1}''{2}', env.SLUG, env.TAG, (env.PUSH_DOCKER_HUB) && ',' || '') || '' }} - ${{ env.PUSH_DOCKER_HUB && format('''docker.io/{0}:{1}''{2}', env.SLUG, env.TAG, ('') && ',' || '') || '' }} - ) \ No newline at end of file + -tags $tags diff --git a/build.ps1 b/build.ps1 index 83772ab..1043b87 100644 --- a/build.ps1 +++ b/build.ps1 @@ -67,10 +67,13 @@ exec buildah manifest create "$manifest" ForEach($platform in $platforms.Split(",")) { $intermediatetag = "$(New-Guid)-intermediate:latest" + $plat = $platform.Split("/") + $arguments = @( "buildah", "build", "--platform=${platform}", + "--build-arg=TARGETARCH=$($plat[1])" "--build-arg=NODE_VERSION=${node}", "--build-arg=DISTRO=${distro}", "--build-arg=TYPE=${type}", @@ -94,7 +97,6 @@ ForEach($platform in $platforms.Split(",")) { $containerName = New-Guid # buildah bug: https://github.com/containers/buildah/commit/4b7d3555bfa4440c3c5264ae44b93822e10deec0 # The arm variant is dropped in the previous step this causes a failure here - $plat = $platform.Split("/") exec buildah from --format=docker --name "$containerName-container" --platform "$($plat[0])/$($plat[1])" "$intermediatetag" $containerpath = exec_out buildah mount "$containerName-container" $envfileContent = Get-Content "$containerpath/etc/environment" diff --git a/build.sh b/build.sh deleted file mode 100755 index 167094b..0000000 --- a/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -docker buildx build \ - --push \ - --progress=plain \ - --tag="ghcr.io/${SLUG}:${TAG}" \ - --tag="quay.io/${SLUG}:${TAG}" \ - --tag="docker.io/${SLUG}:${TAG}" \ - --build-arg="NODE_VERSION=${NODE}" \ - --build-arg="DISTRO=${DISTRO}" \ - --build-arg="TYPE=${TYPE}" \ - --build-arg="RUNNER=${RUNNER}" \ - --build-arg="BUILD_TAG_VERSION=${BUILD_TAG_VERSION}" \ - --build-arg="BUILD_TAG=${BUILD_TAG}" \ - --build-arg="BUILD_REF=${BUILD_REF}" \ - --build-arg="FROM_IMAGE=${FROM_IMAGE}" \ - --build-arg="FROM_TAG=${FROM_TAG}" \ - --file="./linux/${DISTRO}/Dockerfile" \ - --platform="${PLATFORMS}" \ - . diff --git a/linux/ubuntu/scripts/basic.sh b/linux/ubuntu/scripts/basic.sh index d6ea245..085939e 100755 --- a/linux/ubuntu/scripts/basic.sh +++ b/linux/ubuntu/scripts/basic.sh @@ -6,7 +6,12 @@ # source: https://github.com/actions/virtual-environments/blob/5ae2170ebe90a53e1cdc9c507ed3e0f1471d6b66/images/linux/scripts/helpers/install.sh apt-get update -common_packages=$(jq -r ".apt.common_packages[]" "/imagegeneration/toolset.json") +# lib32z1 is not available for arm64 remove it via jq +case "$(uname -m)" in + 'x86_64') common_packages_filter="" ;; + *) common_packages_filter="del(.apt.common_packages[] | select(. == \"lib32z1\"))" ;; +esac +common_packages=$(jq -r "$common_packages_filter .apt.common_packages[]" "/imagegeneration/toolset.json") cmd_packages=$(jq -r ".apt.cmd_packages[]" "/imagegeneration/toolset.json") # we depend on re-splitting behaviour here # shellcheck disable=SC2068 diff --git a/linux/ubuntu/scripts/custom.sh b/linux/ubuntu/scripts/custom.sh index 399a001..1301bff 100755 --- a/linux/ubuntu/scripts/custom.sh +++ b/linux/ubuntu/scripts/custom.sh @@ -32,15 +32,29 @@ bash -c "$(curl -sL https://raw.githubusercontent.com/ilikenwf/apt-fast/master/q # echo '* hard stack 16384' # } >>/etc/security/limits.conf -scripts=( - basic - pwsh - go - js - rust - vcpkg - dotnet -) +case "$(uname -m)" in + 'aarch64') + scripts=( + basic + pwsh + go + js + dotnet + ) + ;; + 'x86_64') + scripts=( + basic + pwsh + go + js + rust + vcpkg + dotnet + ) + ;; + *) exit 1 ;; +esac for SCRIPT in "${scripts[@]}"; do printf "\n\t๐Ÿงจ Executing %s.sh ๐Ÿงจ\t\n" "${SCRIPT}" diff --git a/linux/ubuntu/scripts/go.sh b/linux/ubuntu/scripts/go.sh index 8013870..6d055d5 100755 --- a/linux/ubuntu/scripts/go.sh +++ b/linux/ubuntu/scripts/go.sh @@ -16,11 +16,20 @@ go_arch() { esac } +toolcache_arch() { + case "$(uname -m)" in + 'aarch64') echo 'arm64' ;; + 'x86_64') echo 'x64' ;; + 'armv7l') echo 'armv7l' ;; + *) exit 1 ;; + esac +} + DEFVER=$(jq -r '.toolcache[] | select(.name == "go") | .default' "/imagegeneration/toolset.json") for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegeneration/toolset.json"); do printf "\n\t๐Ÿ‹ Installing GO=%s ๐Ÿ‹\t\n" "${V}" VER=$(jq -r "[.[] | select(.version|test(\"^${V}\"))][0].version" "/tmp/go-toolset.json") - GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/x64" + GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/$(toolcache_arch)" mkdir -v -m 0777 -p "$GOPATH" DL_VER="${VER}" diff --git a/linux/ubuntu/scripts/java-tools.sh b/linux/ubuntu/scripts/java-tools.sh old mode 100644 new mode 100755 index 69fd7d3..bc739c0 --- a/linux/ubuntu/scripts/java-tools.sh +++ b/linux/ubuntu/scripts/java-tools.sh @@ -9,6 +9,31 @@ . /imagegeneration/installers/helpers/install.sh . /imagegeneration/installers/helpers/etc-environment.sh +java_arch() { + case "$(uname -m)" in + 'x86_64') echo 'amd64' ;; + 'aarch64') echo 'arm64' ;; + esac +} + +toolcache_arch() { + case "$(uname -m)" in + 'aarch64') echo 'arm64' ;; + 'x86_64') echo 'x64' ;; + 'armv7l') echo 'armv7l' ;; + *) exit 1 ;; + esac +} + +env_arch() { + case "$(uname -m)" in + 'aarch64') echo 'ARM64' ;; + 'x86_64') echo 'X64' ;; + 'armv7l') echo 'ARMV7L' ;; + *) exit 1 ;; + esac +} + createJavaEnvironmentalVariable() { local JAVA_VERSION=$1 local VENDOR_NAME=$2 @@ -17,10 +42,10 @@ createJavaEnvironmentalVariable() { case ${VENDOR_NAME} in "Adopt" ) - INSTALL_PATH_PATTERN="/usr/lib/jvm/adoptopenjdk-${JAVA_VERSION}-hotspot-amd64" ;; + INSTALL_PATH_PATTERN="/usr/lib/jvm/adoptopenjdk-${JAVA_VERSION}-hotspot-$(java_arch)" ;; "Temurin-Hotspot" ) - INSTALL_PATH_PATTERN="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64" ;; + INSTALL_PATH_PATTERN="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-$(java_arch)" ;; *) echo "Unknown vendor" exit 1 @@ -34,8 +59,8 @@ createJavaEnvironmentalVariable() { update-java-alternatives -s ${INSTALL_PATH_PATTERN} fi - echo "Setting up JAVA_HOME_${JAVA_VERSION}_X64 variable to ${INSTALL_PATH_PATTERN}" - addEtcEnvironmentVariable JAVA_HOME_${JAVA_VERSION}_X64 ${INSTALL_PATH_PATTERN} + echo "Setting up JAVA_HOME_${JAVA_VERSION}_$(env_arch) variable to ${INSTALL_PATH_PATTERN}" + addEtcEnvironmentVariable "JAVA_HOME_${JAVA_VERSION}_$(env_arch)" ${INSTALL_PATH_PATTERN} } enableRepositories() { @@ -67,10 +92,10 @@ installOpenJDK() { # Install Java from PPA repositories. if [[ ${VENDOR_NAME} == "Temurin-Hotspot" ]]; then apt-get -y install temurin-${JAVA_VERSION}-jdk=\* - javaVersionPath="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64" + javaVersionPath="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-$(java_arch)" elif [[ ${VENDOR_NAME} == "Adopt" ]]; then apt-get -y install adoptopenjdk-${JAVA_VERSION}-hotspot=\* - javaVersionPath="/usr/lib/jvm/adoptopenjdk-${JAVA_VERSION}-hotspot-amd64" + javaVersionPath="/usr/lib/jvm/adoptopenjdk-${JAVA_VERSION}-hotspot-$(java_arch)" else echo "${VENDOR_NAME} is invalid, valid names are: Temurin-Hotspot and Adopt" exit 1 @@ -91,10 +116,10 @@ installOpenJDK() { mkdir -p "${javaToolcacheVersionPath}" # Create a complete file - touch "${javaToolcacheVersionPath}/x64.complete" + touch "${javaToolcacheVersionPath}/$(toolcache_arch).complete" # Create symlink for Java - ln -s ${javaVersionPath} "${javaToolcacheVersionPath}/x64" + ln -s ${javaVersionPath} "${javaToolcacheVersionPath}/$(toolcache_arch)" # add extra permissions to be able execute command without sudo chmod -R 777 /usr/lib/jvm @@ -107,25 +132,16 @@ enableRepositories apt-get update defaultVersion=$(get_toolset_value '.java.default') -defaultVendor=$(get_toolset_value '.java.default_vendor') -jdkVendors=($(get_toolset_value '.java.vendors[].name')) +jdkVendor="Temurin-Hotspot" +jdkVersionsToInstall=($(get_toolset_value ".java.versions[]")) -for jdkVendor in ${jdkVendors[@]}; do +for jdkVersionToInstall in ${jdkVersionsToInstall[@]}; do - # get vendor-specific versions - jdkVersionsToInstall=($(get_toolset_value ".java.vendors[] | select (.name==\"${jdkVendor}\") | .versions[]")) + installOpenJDK ${jdkVersionToInstall} ${jdkVendor} - for jdkVersionToInstall in ${jdkVersionsToInstall[@]}; do + isDefaultVersion=False; [[ ${jdkVersionToInstall} == ${defaultVersion} ]] && isDefaultVersion=True - installOpenJDK ${jdkVersionToInstall} ${jdkVendor} - - isDefaultVersion=False; [[ ${jdkVersionToInstall} == ${defaultVersion} ]] && isDefaultVersion=True - - if [[ ${jdkVendor} == ${defaultVendor} ]]; then - createJavaEnvironmentalVariable ${jdkVersionToInstall} ${jdkVendor} ${isDefaultVersion} - fi - - done + createJavaEnvironmentalVariable ${jdkVersionToInstall} ${jdkVendor} ${isDefaultVersion} done # Adopt 12 is only available for Ubuntu 18.04 diff --git a/linux/ubuntu/scripts/js.sh b/linux/ubuntu/scripts/js.sh index 5cf72b1..fd2977d 100755 --- a/linux/ubuntu/scripts/js.sh +++ b/linux/ubuntu/scripts/js.sh @@ -42,11 +42,31 @@ for V in "${versions[@]}"; do "$NODEPATH/bin/node" -v done +# npm timeout under qemu with defaults +set -x +npm config set fetch-timeout 120000 +npm config set fetch-retry-mintimeout 120000 +npm config set fetch-retry-maxtimeout 120000 +npm config set prefer-offline true +npm config set registry http://registry.npmjs.org/ +# Otherwise there are no log updates for 10m+ on qemu +npm config set loglevel verbose +npm config ls -l + printf "\n\t๐Ÿ‹ Installing JS tools ๐Ÿ‹\t\n" npm install -g npm npm install -g pnpm npm install -g yarn -npm install -g grunt gulp n parcel-bundler typescript newman vercel webpack webpack-cli lerna +npm install -g grunt +npm install -g gulp +npm install -g n +npm install -g parcel-bundler +npm install -g typescript +npm install -g newman +npm install -g vercel +npm install -g webpack +npm install -g webpack-cli +npm install -g lerna npm install -g --unsafe-perm netlify-cli printf "\n\t๐Ÿ‹ Installed NPM ๐Ÿ‹\t\n" @@ -61,4 +81,6 @@ yarn -v printf "\n\t๐Ÿ‹ Cleaning image ๐Ÿ‹\t\n" apt-get clean rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' +# remove npm config +npm config edit --editor rm printf "\n\t๐Ÿ‹ Cleaned up image ๐Ÿ‹\t\n" diff --git a/linux/ubuntu/scripts/pwsh.sh b/linux/ubuntu/scripts/pwsh.sh index 51796c6..c8f3855 100755 --- a/linux/ubuntu/scripts/pwsh.sh +++ b/linux/ubuntu/scripts/pwsh.sh @@ -32,8 +32,16 @@ rm /tmp/powershell.tar.gz printf "\n\t๐Ÿ‹ Installed PWSH ๐Ÿ‹\t\n" pwsh -v +case "$(uname -m)" in + 'aarch64') + printf "\n\t๐Ÿ‹ Skip Installing PowerShell modules, due to crash maybe caused by qemu ๐Ÿ‹\t\n" + exit 0 + ;; + *) + modules=("MarkdownPS" "Pester" "PSScriptAnalyzer") + ;; +esac printf "\n\t๐Ÿ‹ Installing PowerShell modules ๐Ÿ‹\t\n" -modules=("MarkdownPS" "Pester" "PSScriptAnalyzer") pwsh -nol -nop -c "Set-PSRepository -Name PSGallery -InstallationPolicy Trusted"