Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CLI, use CDN for CLI downloads #1166

Merged
merged 1 commit into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/ApolloCodegenLib/CLIDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct CLIDownloader {
}

/// The URL string for getting the current version of the CLI
static let downloadURLString = "https://46555-65563448-gh.circle-artifacts.com/0/oclif-pack/apollo-v2.26.0/apollo-v2.26.0-darwin-x64.tar.gz"
static let downloadURLString = "https://install.apollographql.com/legacy-cli/darwin/2.27.2"

/// Downloads the appropriate Apollo CLI in a zip file.
///
Expand Down
5 changes: 3 additions & 2 deletions Sources/ApolloCodegenLib/CLIExtractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct CLIExtractor {
}
}

static let expectedSHASUM = "efc67e140096bb3414a385c5da32dfa0d9a6172ac081f0351998c62b5d3db502"
static let expectedSHASUM = "08c45258b7cc1d4e6e28288930428922fd7dee9ccaad6e5be17dd5b79e6b1af4"

/// Checks to see if the CLI has already been extracted and is the correct version, and extracts or re-extracts as necessary
///
Expand Down Expand Up @@ -118,7 +118,8 @@ struct CLIExtractor {
/// - Parameter zipFileURL: The url to the zip file containing the Apollo CLI.
/// - Parameter expected: The expected SHASUM. Defaults to the real expected SHASUM. This parameter exists mostly for testing.
static func validateZipFileSHASUM(at zipFileURL: URL, expected: String = CLIExtractor.expectedSHASUM) throws {
let shasum = try FileManager.default.apollo_shasum(at: zipFileURL)
let shasum = try FileManager.default.apollo_shasum(at: zipFileURL)
print("SHASUM: \(shasum)")
guard shasum == expected else {
throw CLIExtractorError.zipFileHasInvalidSHASUM(expectedSHASUM: expected, gotSHASUM: shasum)
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-bundled-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SCRIPT_DIR="$(dirname "$0")"

# Get the SHASUM of the tarball
ZIP_FILE="${SCRIPT_DIR}/apollo.tar.gz"
ZIP_FILE_DOWNLOAD_URL="https://46555-65563448-gh.circle-artifacts.com/0/oclif-pack/apollo-v2.26.0/apollo-v2.26.0-darwin-x64.tar.gz"
ZIP_FILE_DOWNLOAD_URL="https://install.apollographql.com/legacy-cli/darwin/2.27.2"
SHASUM_FILE="${SCRIPT_DIR}/apollo/.shasum"
APOLLO_DIR="${SCRIPT_DIR}"/apollo
IS_RETRY="false"
Expand Down Expand Up @@ -58,7 +58,7 @@ extract_cli() {

validate_codegen_and_extract_if_needed() {
# Make sure the SHASUM matches the release for this version
EXPECTED_SHASUM="efc67e140096bb3414a385c5da32dfa0d9a6172ac081f0351998c62b5d3db502"
EXPECTED_SHASUM="08c45258b7cc1d4e6e28288930428922fd7dee9ccaad6e5be17dd5b79e6b1af4"
update_shasum

if [[ ${SHASUM} = ${EXPECTED_SHASUM}* ]]; then
Expand Down