diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml index 481e28d..8474cab 100644 --- a/.github/workflows/create-draft-release.yml +++ b/.github/workflows/create-draft-release.yml @@ -53,9 +53,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Run Integration Tests - run: ./scripts/integration.sh --use-token --builder ${{ matrix.builder }} + run: ./scripts/integration.sh --builder ${{ matrix.builder }} --token ${{ github.token }} env: - GIT_TOKEN: ${{ github.token }} TMPDIR: "${{ runner.temp }}" release: diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 487e1a2..6574ff7 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -55,9 +55,8 @@ jobs: uses: actions/checkout@v3 - name: Run Integration Tests - run: ./scripts/integration.sh --use-token --builder ${{ matrix.builder }} + run: ./scripts/integration.sh --builder ${{ matrix.builder }} --token ${{ github.token }} env: - GIT_TOKEN: ${{ github.token }} TMPDIR: "${{ runner.temp }}" roundup: diff --git a/scripts/.util/git.sh b/scripts/.util/git.sh deleted file mode 100644 index 71965bc..0000000 --- a/scripts/.util/git.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -eu -set -o pipefail - -# shellcheck source=SCRIPTDIR/print.sh -source "$(dirname "${BASH_SOURCE[0]}")/print.sh" - -function util::git::token::fetch() { - if [[ -z "${GIT_TOKEN:-""}" ]]; then - util::print::title "Fetching GIT_TOKEN" - - GIT_TOKEN="$( - lpass show Shared-CF\ Buildpacks/concourse-private.yml \ - | grep buildpacks-github-token \ - | cut -d ' ' -f 2 - )" - fi - - printf "%s" "${GIT_TOKEN}" -} diff --git a/scripts/integration.sh b/scripts/integration.sh index 13a5635..8e98b15 100755 --- a/scripts/integration.sh +++ b/scripts/integration.sh @@ -19,15 +19,12 @@ source "${PROGDIR}/.util/git.sh" source "${PROGDIR}/.util/builders.sh" function main() { - local builderArray + local builderArray token builderArray=() + token="" + while [[ "${#}" != 0 ]]; do case "${1}" in - --use-token|-t) - shift 1 - token::fetch - ;; - --help|-h) shift 1 usage @@ -39,6 +36,11 @@ function main() { shift 2 ;; + --token|-t) + token="${2}" + shift 2 + ;; + "") # skip if the argument is empty shift 1 @@ -53,7 +55,7 @@ function main() { util::print::warn "** WARNING No Integration tests **" fi - tools::install "${GIT_TOKEN:-}" + tools::install "${token}" if [ ${#builderArray[@]} -eq 0 ]; then util::print::title "No builders provided. Finding builders in integration.json..." @@ -93,9 +95,9 @@ Runs the integration test suite. OPTIONS --help -h prints the command usage - --use-token -t use GIT_TOKEN from lastpass --builder -b sets the name of the builder(s) that are pulled / used for testing. Defaults to "builders" array in integration.json, if present. + --token Token used to download assets from GitHub (e.g. jam, pack, etc) (optional) USAGE } @@ -144,11 +146,6 @@ function builder_images::pull() { docker pull "${lifecycle_image}" } -function token::fetch() { - GIT_TOKEN="$(util::git::token::fetch)" - export GIT_TOKEN -} - function tests::run() { util::print::title "Run Buildpack Runtime Integration Tests" util::print::info "Using ${1} as builder..."