github.com/hashicorp/packer@v1.14.3/scripts/sign.sh (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: BUSL-1.1
     3  
     4  
     5  #!/usr/bin/env bash
     6  
     7  # This script uploads the Darwin builds to artifactory, then triggers the
     8  # circle ci job that signs them.
     9  
    10  # ARTIFACTORY_USER="sa-circle-codesign"
    11  # export PRODUCT_NAME="packer"
    12  # export ARTIFACTORY_TOKEN=$ARTIFACTORY_TOKEN
    13  
    14  ARTIFACTORY_TOKEN="${ARTIFACTORY_TOKEN:-""}"
    15  
    16  if [ -z "$ARTIFACTORY_TOKEN" ]; then
    17    echo "Missing required Artifactory credentials"
    18    exit 1
    19  fi
    20  
    21  # Get the parent directory of where this script is.
    22  SOURCE="${BASH_SOURCE[0]}"
    23  while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
    24  DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
    25  # Change into that dir because we expect that
    26  cd $DIR
    27  
    28  BIN_UUIDS=()
    29  BUILD_NUMBERS=()
    30  for DARWIN_BIN in $(find ./pkg/dist/*darwin_*.zip); do
    31    echo "signing $DARWIN_BIN"
    32    export ARTIFACTORY_USER="sa-circle-codesign"
    33    export PRODUCT_NAME="packer"
    34    export ARTIFACTORY_TOKEN=$ARTIFACTORY_TOKEN
    35    export TARGET_ZIP=$DARWIN_BIN
    36  
    37    echo $TARGET_ZIP
    38    ./scripts/codesign_example.sh
    39    if [ $? -ne 0 ]; then
    40    	exit 1
    41    fi
    42  done
    43  
    44  exit 0