Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d59f88f9c6
commit
f97c2dd79f
@ -18,6 +18,17 @@
|
||||
name = UpdateDependency;
|
||||
productName = UpdateDependency;
|
||||
};
|
||||
EA985CBC298AE8CB00F2FF2E /* Artifactory */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = EA985CBF298AE8CC00F2FF2E /* Build configuration list for PBXAggregateTarget "Artifactory" */;
|
||||
buildPhases = (
|
||||
EA985CC0298AE8D000F2FF2E /* ShellScript */,
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Artifactory;
|
||||
productName = Artifactory;
|
||||
};
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
@ -395,6 +406,9 @@
|
||||
D2B1E43722F9F84E0065F95C = {
|
||||
CreatedOnToolsVersion = 10.3;
|
||||
};
|
||||
EA985CBC298AE8CB00F2FF2E = {
|
||||
CreatedOnToolsVersion = 14.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = D2B1E3EA22F4A68F0065F95C /* Build configuration list for PBXProject "JSONCreator" */;
|
||||
@ -414,6 +428,7 @@
|
||||
targets = (
|
||||
D2B1E3EE22F4A68F0065F95C /* JSONCreator */,
|
||||
D2B1E43722F9F84E0065F95C /* UpdateDependency */,
|
||||
EA985CBC298AE8CB00F2FF2E /* Artifactory */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -450,6 +465,23 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "#!/bin/bash\n\ncd ../\nsh update.sh\n";
|
||||
};
|
||||
EA985CC0298AE8D000F2FF2E /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# Type a script or drag a script file from your workspace to insert its path.\ncd \"${PROJECT_DIR}\"\ncd ../\ncd \"Supporting Files/Artifactory\"\nmkdir -p \"../../SharedFrameworks\"\nsh DownloadArtifactoryItems.sh\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@ -708,6 +740,24 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EA985CBD298AE8CC00F2FF2E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = FCMA4QKS77;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EA985CBE298AE8CC00F2FF2E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = FCMA4QKS77;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@ -738,6 +788,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EA985CBF298AE8CC00F2FF2E /* Build configuration list for PBXAggregateTarget "Artifactory" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EA985CBD298AE8CC00F2FF2E /* Debug */,
|
||||
EA985CBE298AE8CC00F2FF2E /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = D2B1E3E722F4A68F0065F95C /* Project object */;
|
||||
|
||||
81
Supporting Files/Artifactory/Artifactory.sh
Executable file
81
Supporting Files/Artifactory/Artifactory.sh
Executable file
@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
|
||||
#First arg should be the local path, second arg should be the remote path.
|
||||
VERSION="2.0"
|
||||
#Update onces stable
|
||||
#APITOKEN=AKCp5cbwXBA2Rarq6WagmFFxQxcxsARGxSq5g1H8NaGm7837KTgwdWPqsp7FdgRa13B7AcpGN
|
||||
#URL=https://oneartifactorycloud.verizon.com/artifactory
|
||||
|
||||
APITOKEN=AKCp5ZmHP8B1dkLtdSh23bMcWHtrWzoB3SfhoCNpEC5e3dKNhiKsn8TPMZQafXzm2qkeXFXE6
|
||||
URL=https://oneartifactoryprod.verizon.com/artifactory
|
||||
|
||||
LOCALPATH="${1}"
|
||||
REMOTEPATH="${2}"
|
||||
LOGFILE=$3
|
||||
LOCALDIR=$(dirname "${LOCALPATH}")
|
||||
LOCALBASE=$(basename "${LOCALPATH}")
|
||||
NEWFILEPATH="${LOCALDIR}"/$(basename "${REMOTEPATH}")
|
||||
VERSIONFILE=./Checksums/"${LOCALBASE}".txt
|
||||
|
||||
if [ -z $LOGFILE ]; then
|
||||
LOGFILE="/tmp/${LOCALBASE}.txt"
|
||||
fi
|
||||
|
||||
#first argument is error message.
|
||||
exit_with_error () {
|
||||
echo "Error: $1" >> "${LOGFILE}"
|
||||
if [ -f "${NEWFILEPATH}" ]; then
|
||||
rm -rf "${NEWFILEPATH}" 2>>"${LOGFILE}"
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "----------------------------------------------------------" >> $LOGFILE
|
||||
echo "Logs for ${LOCALBASE}" >> $LOGFILE
|
||||
|
||||
echo -e "Local Target: ${LOCALPATH}" >> $LOGFILE
|
||||
echo -e "Remote Source: ${REMOTEPATH}" >> $LOGFILE
|
||||
|
||||
if [ -z "$LOCALPATH" ]; then
|
||||
exit_with_error "Missing local path argument"
|
||||
fi
|
||||
|
||||
if [ -z "$REMOTEPATH" ]; then
|
||||
exit_with_error "Missing filename path argument"
|
||||
fi
|
||||
|
||||
#get local and remote checksums for comparison
|
||||
echo -e "Getting checksums..." >> $LOGFILE
|
||||
echo -e "URL: ${URL}/api/storage/${REMOTEPATH}" >> $LOGFILE
|
||||
JSON=$(curl --header "X-JFrog-Art-Api: ${APITOKEN}" -X GET "${URL}/api/storage/${REMOTEPATH}" 2>>"${LOGFILE}")
|
||||
CHECKSUM=$(echo "$JSON" | python3 -c 'import sys, json; print(json.load(sys.stdin)["checksums"]["sha1"])') 2>>"${LOGFILE}"
|
||||
if [[ -z "$CHECKSUM" ]]; then
|
||||
exit_with_error "No Checksum found in json: ${JSON}"
|
||||
fi
|
||||
echo "Remote checksum ${CHECKSUM}" >> "${LOGFILE}"
|
||||
OLDCHECKSUM=$(cat "${VERSIONFILE}" 2>/dev/null)
|
||||
echo "Local checksum ${OLDCHECKSUM}" >> "${LOGFILE}"
|
||||
|
||||
#get new framework if no original framework, no local checksum, or remote checksum is different from local.
|
||||
if [ ! -e "${LOCALPATH}" ] || [ -z "$OLDCHECKSUM" ] || [ "$CHECKSUM" != "$OLDCHECKSUM" ]; then
|
||||
echo "Downloading..." >> "${LOGFILE}"
|
||||
echo -e "URL: ${URL}/${REMOTEPATH}" >> $LOGFILE
|
||||
curl --header "X-JFrog-Art-Api: ${APITOKEN}" -f -X GET "$URL/$REMOTEPATH" --output "${NEWFILEPATH}" 2>>"${LOGFILE}"
|
||||
if [ $? -eq 0 ] && [ -e "${NEWFILEPATH}" ]; then
|
||||
echo "Finished Downloading, begin unzip" >> "${LOGFILE}"
|
||||
unzip -q -o "${NEWFILEPATH}" -d "${LOCALDIR}" 2>>"${LOGFILE}"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Finished unzipping, remove zip" >> "${LOGFILE}"
|
||||
rm -rf "${NEWFILEPATH}" 2>>"${LOGFILE}"
|
||||
echo "Writing new checksum to file" >> "${LOGFILE}"
|
||||
echo "${CHECKSUM}" > "${VERSIONFILE}" 2>>"${LOGFILE}"
|
||||
echo "Successfully downloaded and unzipped archive." >> "${LOGFILE}"
|
||||
else
|
||||
exit_with_error "Error unzipping"
|
||||
fi
|
||||
else
|
||||
exit_with_error "Failed to download"
|
||||
fi
|
||||
else
|
||||
echo "Successful, No New Version" >> "${LOGFILE}"
|
||||
fi
|
||||
3
Supporting Files/Artifactory/ArtifactoryItems.txt
Normal file
3
Supporting Files/Artifactory/ArtifactoryItems.txt
Normal file
@ -0,0 +1,3 @@
|
||||
../../SharedFrameworks/VDSColorTokens.xcframework GVJV_VDS_Maven/%40vds-tokens/ios/VDSColorTokens.1.0.6.xcframework.zip
|
||||
../../SharedFrameworks/VDSFormControlsTokens.xcframework GVJV_VDS_Maven/@vds-tokens/ios/VDSFormControlsTokens.1.0.7.xcframework.zip
|
||||
../../SharedFrameworks/VDSTypographyTokens.xcframework GVJV_VDS_Maven/@vds-tokens/ios/VDSTypographyTokens.2.0.0.xcframework.zip
|
||||
79
Supporting Files/Artifactory/DownloadArtifactoryItems.sh
Normal file
79
Supporting Files/Artifactory/DownloadArtifactoryItems.sh
Normal file
@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
|
||||
# DownloadArtifactoryItems.sh
|
||||
# myverizon
|
||||
#
|
||||
# Created by Kyle on 3/2/20.
|
||||
# Copyright © 2020 Verizon Wireless Inc. All rights reserved.
|
||||
|
||||
ARTIFACTORYITEMS=./ArtifactoryItems.txt
|
||||
ARTIFACTORY=Artifactory.sh
|
||||
|
||||
update_artifactory_item () {
|
||||
#echo "Run Artifactory for ${1} from ${2}"
|
||||
./${ARTIFACTORY} "${1}" "${2}"
|
||||
}
|
||||
|
||||
#Loop through items needed to download and download them.
|
||||
PIDARRAY=()
|
||||
LOGFILEARRAY=()
|
||||
while read -r LOCALFILE REMOTEFILE; do
|
||||
|
||||
#for if the directory has a parameter, such as PROJECT_DIR
|
||||
FILE=$(eval echo ${LOCALFILE})
|
||||
LOGFILE="/tmp/$(basename ${FILE}).txt"
|
||||
rm $LOGFILE 2> /dev/null
|
||||
touch $LOGFILE
|
||||
|
||||
#download them in parallel and store the PIDS.
|
||||
update_artifactory_item "${FILE}" $REMOTEFILE $LOGFILE &
|
||||
PIDARRAY+=($!)
|
||||
LASTPID=${PIDARRAY[${#PIDARRAY[@]}-1]}
|
||||
LOGFILEARRAY+=($LOGFILE)
|
||||
echo "Process ${LASTPID} spawned for ${REMOTEFILE##*/}"
|
||||
|
||||
done < "${ARTIFACTORYITEMS}"
|
||||
|
||||
#wait for all processes to finish and fail if one of them fails.
|
||||
INDEX=-1
|
||||
TOTAL=${#PIDARRAY[@]}
|
||||
for i in "${PIDARRAY[@]}"; do
|
||||
|
||||
INDEX=$((INDEX + 1))
|
||||
LOGFILE=${LOGFILEARRAY[$((INDEX))]}
|
||||
|
||||
echo "\n\n$((INDEX + 1)) / ${TOTAL} (PID: ${i}) "
|
||||
|
||||
# tail the subprocess log
|
||||
tail -n +1 -f $LOGFILE &
|
||||
READ_PID=$!
|
||||
|
||||
# wait for subprocess to finish
|
||||
sleep 0.05 # Allow tail -n +1 to print
|
||||
wait $i
|
||||
|
||||
# catch any subprocess non-zero status
|
||||
status=$?
|
||||
if [[ $status -gt 0 ]]; then
|
||||
FAILED_PID_STATUS=$status
|
||||
FAILED_PID=$i
|
||||
fi
|
||||
|
||||
# kill the running tail, consume the kill output
|
||||
kill $READ_PID
|
||||
wait $READ_PID > /dev/null 2>&1
|
||||
|
||||
# Need proper way to terminate children.
|
||||
#if [[ -n $FAILED_PID ]] && [[ -n $FAIL_EARLY ]]; then
|
||||
# echo "\n\nProcess ${FAILED_PID} failed with exit code ${FAILED_PID_STATUS}"
|
||||
# echo $( ps -o pgid $FAILED_PID | grep [0-9] | tr -d ' ' )
|
||||
# kill -9 $(printf '%s ' "${PIDARRAY[@]}")
|
||||
# exit $FAILED_PID_STATUS
|
||||
#fi
|
||||
|
||||
done
|
||||
|
||||
if [[ -n $FAILED_PID_STATUS ]]; then
|
||||
echo "\n\nProcess ${FAILED_PID} failed with exit code ${FAILED_PID_STATUS}"
|
||||
exit $FAILED_PID_STATUS
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user