-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
func: add script to install binary locally
- Loading branch information
1 parent
07d8e1a
commit 56d04b2
Showing
7 changed files
with
50 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,15 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
output "url" { | ||
value = data.enos_artifactory_item.nomad.results[0].url | ||
description = "The artifactory download url for the artifact" | ||
} | ||
|
||
output "sha256" { | ||
value = data.enos_artifactory_item.nomad.results[0].sha256 | ||
description = "The sha256 checksum for the artifact" | ||
} | ||
|
||
output "size" { | ||
value = data.enos_artifactory_item.nomad.results[0].size | ||
description = "The size in bytes of the artifact" | ||
} | ||
|
||
output "name" { | ||
value = data.enos_artifactory_item.nomad.results[0].name | ||
description = "The name of the artifact" | ||
output "local_binary" { | ||
value = var.binary_path | ||
description = "Path where the binary will be placed" | ||
} | ||
|
||
output "vault_artifactory_release" { | ||
description = "Binary information returned from the artifactory" | ||
value = { | ||
url = data.enos_artifactory_item.nomad.results[0].url | ||
sha256 = data.enos_artifactory_item.nomad.results[0].sha256 | ||
username = var.artifactory_username | ||
token = var.artifactory_token | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
enos/modules/fetch_artifactory/scripts/install.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
set -xeuo pipefail | ||
|
||
# Variables | ||
OUTPUT="nomad.zip" # Name for the downloaded file | ||
|
||
# Download the file | ||
wget --header="X-JFrog-Art-Api:$TOKEN" -O- "$OUTPUT" "$URL" | ||
|
||
# Check if the file was downloaded | ||
if [ $? -nq 0 ]; then | ||
echo "Error downloading file." >&2 | ||
exit 1 | ||
fi | ||
|
||
# Create the BINARY_PATH directory | ||
mkdir -p "$BINARY_PATH" | ||
|
||
# Unzip the file | ||
unzip -o "$OUTPUT" -d "$BINARY_PATH" | ||
|
||
# Check if the file was unzipped | ||
if [ $? -nq 0 ]; then | ||
echo "Error unzipping file." >&2 | ||
exit 1 | ||
fi | ||
|
||
# Remove the zip file | ||
rm $OUTPUT |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters