Skip to content

Commit

Permalink
Merge pull request #406 from okta/fix_node_version
Browse files Browse the repository at this point in the history
Update node version to enable publishing plugin
  • Loading branch information
rajdeepnanua-okta authored Jan 17, 2024
2 parents 483a38b + 6225db9 commit 595c4a8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .bacon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ test_suites:
timeout: '60'
script_name: lint
criteria: MERGE
queue_name: small
queue_name: ci-queue-productionJenga-AL2023
- name: unit
script_path: /root/okta/okta-react-native/scripts
sort_order: '2'
timeout: '10'
script_name: unit
criteria: MERGE
queue_name: small
queue_name: ci-queue-productionJenga-AL2023
- name: publish
script_path: /root/okta/okta-react-native/scripts
sort_order: '3'
timeout: '60'
script_name: publish
criteria: MERGE
queue_name: small
queue_name: ci-queue-productionJenga-AL2023
- name: sast_scan
script_path: /root/okta/okta-react-native/scripts
script_name: sast_scan
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -xe
#!/bin/bash

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

Expand Down
2 changes: 1 addition & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -xe
#!/bin/bash

source $OKTA_HOME/$REPO/scripts/setup.sh

Expand Down
51 changes: 20 additions & 31 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
#!/bin/bash -xe
#!/bin/bash

export NVM_DIR="/root/.nvm"

# Install required node version
setup_service node v16.19.0

# Install yarn
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.17.3
# Link the installed yarn to be default
ln -sf ~/.yarn/bin/yarn /usr/bin/yarn

# Add yarn to the $PATH so npm cli commands do not fail
export PATH="${PATH}:$(yarn global bin)"
setup_service node v20.5.0

# determine the linux distro
distro=$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release | tr -d '"')
echo $distro

# yarn installation is different, depending on distro
if [ "$distro" = "centos" ]; then
# Use the cacert bundled with centos as okta root CA is self-signed and cause issues downloading from yarn
setup_service yarn 1.21.1 /etc/pki/tls/certs/ca-bundle.crt
# Add yarn to the $PATH so npm cli commands do not fail
export PATH="${PATH}:$(yarn global bin)"
elif [ "$distro" = "amzn" ]; then
npm install -g yarn
export PATH="$PATH:$(npm config get prefix)/bin"
else
echo "Unknown OS environment, exiting..."
exit ${FAILED_SETUP}
fi

cd ${OKTA_HOME}/${REPO}

Expand All @@ -25,28 +35,7 @@ git reset --hard $SHA
git config --global user.email "[email protected]"
git config --global user.name "oktauploader-okta"

#!/bin/bash
YARN_REGISTRY=https://registry.yarnpkg.com
OKTA_REGISTRY=${ARTIFACTORY_URL}/api/npm/npm-okta-master

# Yarn does not utilize the npmrc/yarnrc registry configuration
# if a lockfile is present. This results in `yarn install` problems
# for private registries. Until [email protected] is released, this is our current
# workaround.
#
# Related issues:
# - https://github.com/yarnpkg/yarn/issues/5892
# - https://github.com/yarnpkg/yarn/issues/3330

# Replace yarn registry with Okta's
echo "Replacing $YARN_REGISTRY with $OKTA_REGISTRY within yarn.lock files..."
sed -i "s#${YARN_REGISTRY}#${OKTA_REGISTRY}#" yarn.lock

if ! yarn install ; then
echo "yarn install failed! Exiting..."
exit ${FAILED_SETUP}
fi

# Revert the original change(s)
echo "Replacing $OKTA_REGISTRY with $YARN_REGISTRY within yarn.lock files..."
sed -i "s#${OKTA_REGISTRY}#${YARN_REGISTRY}#" yarn.lock
2 changes: 1 addition & 1 deletion scripts/unit.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -x
#!/bin/bash

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

Expand Down

0 comments on commit 595c4a8

Please sign in to comment.