Skip to content

Commit 0a5917f

Browse files
authored
Merge pull request #824 from puppetlabs/nightly_no_token
(PA-8041) Fix puppetcore8-nightly installs on rpm and mac
2 parents 14513ea + 99ee4c1 commit 0a5917f

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

docker/bin/helpers/run-install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fi
2727
export PT__installdir=../
2828
export PT_version=${to_version}
2929
export PT_collection=${to_collection}
30+
export PT_username=${PUPPET_FORGE_USERNAME}
3031
export PT_password=${PUPPET_FORGE_TOKEN}
3132
chmod u+x tasks/install_shell.sh
3233
tasks/install_shell.sh

docker/bin/install.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
# Default: 8.1.0
2020
set -e
2121

22-
if [[ -z "${PUPPET_FORGE_TOKEN}" ]]; then
23-
echo "$0: Environment variable PUPPET_FORGE_TOKEN must be set"
24-
exit 1
25-
fi
26-
2722
cd "$(dirname "$0")/../.."
2823
platforms=${1:-rocky}
2924
version=${2:-8.11.0}
3025
collection=${3:-puppetcore8}
26+
27+
if [[ -z "${PUPPET_FORGE_TOKEN}" && "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then
28+
echo "$0: Environment variable PUPPET_FORGE_TOKEN must be set"
29+
exit 1
30+
fi
31+
3132
for platform in ${platforms//,/ }
3233
do
3334
case $platform in
@@ -71,6 +72,6 @@ do
7172
# Add "--progress plain" for complete build output
7273
docker build --rm -f "${dockerfile}" . -t pa-dev:$platform.install \
7374
--build-arg BASE_IMAGE="${base_image}"
74-
docker run -e PUPPET_FORGE_TOKEN --rm -ti pa-dev:$platform.install "${version}" "${collection}"
75+
docker run -e PUPPET_FORGE_USERNAME -e PUPPET_FORGE_TOKEN --rm -ti pa-dev:$platform.install "${version}" "${collection}"
7576
done
7677
echo Complete

tasks/install_shell.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ install_file() {
629629

630630
repo="/etc/yum.repos.d/${collection/core/}-release.repo"
631631
rpm -Uvh --oldpackage --replacepkgs "$2"
632-
if [[ "$collection" =~ core ]]; then
632+
if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then
633633
if [[ -n $username ]]; then
634634
sed -i "s/^#\?username=.*/username=${username}/" "${repo}"
635635
fi
@@ -661,7 +661,7 @@ install_file() {
661661
fi
662662

663663
run_cmd "zypper install --no-confirm '$2'"
664-
if [[ "$collection" =~ core ]]; then
664+
if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then
665665
if [[ -n $username ]]; then
666666
sed -i "s/^username=.*/username=${username}/" "/etc/zypp/credentials.d/PuppetcoreCreds"
667667
fi
@@ -842,7 +842,7 @@ case $platform in
842842
if [[ $(uname -p) == "arm" ]]; then
843843
arch="arm64"
844844
fi
845-
if [[ "$collection" =~ "puppetcore" ]]; then
845+
if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then
846846
if [[ -z "$version" ]]; then
847847
critical "You must provide a version to install the agent from puppetcore on MacOS/Windows."
848848
exit 1
@@ -854,7 +854,7 @@ case $platform in
854854
download_url="${mac_source}?type=native&version=${version}&os_name=osx&os_version=${platform_version}&os_arch=${arch}"
855855
fi
856856
else
857-
download_url="${mac_source}/mac/${collection}/${platform_version}/${arch}/${filename}"
857+
download_url="${mac_source}/mac/${collection/core/}/${platform_version}/${arch}/${filename}"
858858
fi
859859
;;
860860
*)

0 commit comments

Comments
 (0)