Skip to content

Commit 244b934

Browse files
author
Jacob Woffenden
authored
✨ Add Cloud Platform feature (#10)
Signed-off-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk>
1 parent cc9e469 commit 244b934

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- markdownlint-disable MD003 -->
2+
# Changelog
3+
4+
All notable changes to this project will be documented in this file.
5+
6+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8+
9+
## [Unreleased]
10+
11+
## [0.0.1] - 2024-01-30
12+
13+
### Added
14+
15+
- Initial release of feature
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "cloud-platform",
3+
"version": "0.0.1",
4+
"name": "Cloud Platform",
5+
"description": "Installs the Cloud Platform CLI",
6+
"options": {
7+
"cloudPlatformCliVersion": {
8+
"type": "string",
9+
"description": "Version of the Cloud Platform CLI to install",
10+
"default": "latest"
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# shellcheck source=/dev/null
6+
# file not accessible until being built
7+
source /usr/local/bin/devcontainer-utils
8+
9+
get_system_architecture
10+
11+
GITHUB_REPOSITORY="ministryofjustice/cloud-platform-cli"
12+
VERSION=${CLOUDPLATFORMCLIVERSION:-"latest"}
13+
14+
if [[ "${VERSION}" == "latest" ]]; then
15+
get_github_latest_tag "${GITHUB_REPOSITORY}"
16+
VERSION="${GITHUB_LATEST_TAG}"
17+
VERSION_STRIP_V="${GITHUB_LATEST_TAG_STRIP_V}"
18+
else
19+
# shellcheck disable=SC2034
20+
VERSION_STRIP_V="${VERSION#v}"
21+
fi
22+
23+
curl --fail-with-body --location "https://github.com/${GITHUB_REPOSITORY}/releases/download/${VERSION}/cloud-platform-cli_${VERSION}_linux_${ARCHITECTURE}.tar.gz" \
24+
--output "cloud-platform-cli_${VERSION}_linux_${ARCHITECTURE}.tar.gz"
25+
26+
tar --gzip --extract --file "cloud-platform-cli_${VERSION}_linux_${ARCHITECTURE}.tar.gz"
27+
28+
install --owner=vscode --group=vscode --mode=775 cloud-platform /usr/local/bin/cloud-platform
29+
30+
install --owner=vscode --group=vscode --mode=775 completions/cloud-platform.zsh /usr/local/share/zsh/site-functions/_cloud-platform
31+
32+
rm --recursive --force LICENSE README.md completions "cloud-platform-cli_${VERSION}_linux_${ARCHITECTURE}.tar.gz"
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# shellcheck source=/dev/null
4+
# file not accessible until being built
5+
source /usr/local/bin/devcontainer-utils
6+
7+
logger "info" "Installing Cloud Platform CLI (version: ${CLOUDPLATFORMCLIVERSION})"
8+
bash "$(dirname "${0}")"/install-cloud-platform-cli.sh

features/test/cloud-platform/test.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# shellcheck source=/dev/null
6+
# file only accessible when using devcontainer CLI
7+
source dev-container-features-test-lib
8+
9+
check "cloud-platform version" cloud-platform version
10+
check "cloud-platform completions existence" stat /usr/local/share/zsh/site-functions/_cloud-platform
11+
12+
reportResults

0 commit comments

Comments
 (0)