Skip to content

Commit 0c1d2bd

Browse files
Standardize-new-features (#506)
* chore: standardize direnv feature * chore: standardize kubectx-kubens feature
1 parent 9c1e139 commit 0c1d2bd

File tree

11 files changed

+61
-58
lines changed

11 files changed

+61
-58
lines changed

src/direnv/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
12
# Direnv (via Github Releases) (direnv)
23

3-
direnv is an extension for your shell. It augments existing shells with a new
4-
feature that can load and unload environment variables depending on the current
5-
directory.
4+
direnv is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.
65

76
## Example DevContainer Usage
87

@@ -17,3 +16,5 @@ directory.
1716
| Options Id | Description | Type | Default Value |
1817
|-----|-----|-----|-----|
1918
| version | Select the version to install. | string | latest |
19+
20+

src/direnv/devcontainer-feature.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"id": "direnv",
3-
"version": "1.0.6",
4-
"name": "Direnv (via Github Releases)",
5-
"documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/direnv",
6-
"description": "direnv is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.",
7-
"options": {
8-
"version": {
9-
"default": "latest",
10-
"description": "Select the version to install.",
11-
"proposals": ["latest"],
12-
"type": "string"
13-
}
14-
},
15-
"installsAfter": ["ghcr.io/devcontainers-contrib/features/gh-release"]
16-
}
2+
"id": "direnv",
3+
"version": "1.0.0",
4+
"name": "Direnv (via Github Releases)",
5+
"documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/direnv",
6+
"description": "direnv is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.",
7+
"options": {
8+
"version": {
9+
"default": "latest",
10+
"description": "Select the version to install.",
11+
"proposals": [
12+
"latest"
13+
],
14+
"type": "string"
15+
}
16+
},
17+
"installsAfter": [
18+
"ghcr.io/devcontainers-contrib/features/gh-release"
19+
]
20+
}

src/direnv/install.sh

100644100755
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ source ./library_scripts.sh
66

77
# nanolayer is a cli utility which keeps container layers as small as possible
88
# source code: https://github.com/devcontainers-contrib/nanolayer
9-
# `ensure_nanolayer` is a bash function that will find any existing nanolayer installations,
10-
# and if missing - will download a temporary copy that automatically get deleted at the end
9+
# `ensure_nanolayer` is a bash function that will find any existing nanolayer installations,
10+
# and if missing - will download a temporary copy that automatically get deleted at the end
1111
# of the script
12-
ensure_nanolayer nanolayer_location "v0.4.39"
12+
ensure_nanolayer nanolayer_location "v0.4.46"
13+
1314

1415
$nanolayer_location \
1516
install \
1617
devcontainer-feature \
17-
"ghcr.io/devcontainers-contrib/features/gh-release:1.0.17" \
18+
"ghcr.io/devcontainers-contrib/features/gh-release:1.0.18" \
1819
--option repo='direnv/direnv' --option binaryNames='direnv' --option version="$VERSION"
20+
21+
1922

2023
echo 'Done!'
24+

src/direnv/library_scripts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
clean_download() {
5-
# The purpose of this function is to download a file with minimal impact on contaier layer size
5+
# The purpose of this function is to download a file with minimal impact on container layer size
66
# this means if no valid downloader is found (curl or wget) then we install a downloader (currently wget) in a
77
# temporary manner, and making sure to
88
# 1. uninstall the downloader at the return of the function
@@ -116,7 +116,7 @@ ensure_nanolayer() {
116116
fi
117117
elif [ -f "${NANOLAYER_CLI_LOCATION}" ] && [ -x "${NANOLAYER_CLI_LOCATION}" ] ; then
118118
nanolayer_location=${NANOLAYER_CLI_LOCATION}
119-
echo "Found a pre-existing nanolayer which were given in env varialbe: $nanolayer_location"
119+
echo "Found a pre-existing nanolayer which were given in env variable: $nanolayer_location"
120120
fi
121121

122122
# make sure its of the required version

src/kubectx-kubens/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
kubectx is a tool to switch between contexts (clusters) on kubectl faster. kubens is a tool to switch between Kubernetes namespaces (and configure them for kubectl) easily.
55

6-
## Example Usage
6+
## Example DevContainer Usage
77

88
```json
99
"features": {
@@ -18,7 +18,3 @@ kubectx is a tool to switch between contexts (clusters) on kubectl faster. kuben
1818
| version | Select the version you would like to install (will apply for for both kubectx and kubens.) | string | latest |
1919

2020

21-
22-
---
23-
24-
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers-contrib/features/blob/main/src/kubectx-kubens/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"name": "Kubectx and Kubens (via Github Releases)",
32
"id": "kubectx-kubens",
43
"version": "1.0.3",
4+
"name": "Kubectx and Kubens (via Github Releases)",
5+
"documentationURL": "http://github.com/devcontainers-contrib/features/tree/main/src/kubectx-kubens",
56
"description": "kubectx is a tool to switch between contexts (clusters) on kubectl faster. kubens is a tool to switch between Kubernetes namespaces (and configure them for kubectl) easily.",
6-
"documentationURL": "https://github.com/devcontainers-contrib/features/tree/main/src/kubectx-kubens",
7-
"installsAfter": [
8-
"ghcr.io/devcontainers/features/kubectl-helm-minikube:latest"
9-
],
107
"options": {
118
"version": {
12-
"type": "string",
9+
"default": "latest",
10+
"description": "Select the version you would like to install (will apply for for both kubectx and kubens.)",
1311
"proposals": [
1412
"latest",
1513
"0.9.4"
1614
],
17-
"default": "latest",
18-
"description": "Select the version you would like to install (will apply for for both kubectx and kubens.)"
15+
"type": "string"
1916
}
20-
}
17+
},
18+
"installsAfter": [
19+
"ghcr.io/devcontainers-contrib/features/gh-release"
20+
]
2121
}

src/kubectx-kubens/install.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env bash
2-
3-
KUBECTX_KUBENS_VERSION="${VERSION:-"latest"}"
1+
#!/bin/bash -i
42

53
set -e
64

@@ -11,23 +9,24 @@ source ./library_scripts.sh
119
# `ensure_nanolayer` is a bash function that will find any existing nanolayer installations,
1210
# and if missing - will download a temporary copy that automatically get deleted at the end
1311
# of the script
14-
ensure_nanolayer nanolayer_location "v0.4.45"
12+
ensure_nanolayer nanolayer_location "v0.4.46"
1513

16-
if [ "$(id -u)" -ne 0 ]; then
17-
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
18-
exit 1
19-
fi
2014

2115
$nanolayer_location \
2216
install \
2317
devcontainer-feature \
24-
"ghcr.io/devcontainers-contrib/features/gh-release:1" \
25-
--option repo='ahmetb/kubectx' --option binaryNames='kubectx' --option version="$KUBECTX_KUBENS_VERSION" --option assetRegex="kubectx.*"
18+
"ghcr.io/devcontainers-contrib/features/gh-release:1.0.18" \
19+
--option repo='ahmetb/kubectx' --option binaryNames='kubectx' --option assetRegex='kubectx.*' --option version="$VERSION"
20+
21+
2622

2723
$nanolayer_location \
2824
install \
2925
devcontainer-feature \
30-
"ghcr.io/devcontainers-contrib/features/gh-release:1" \
31-
--option repo='ahmetb/kubectx' --option binaryNames='kubens' --option version="$KUBECTX_KUBENS_VERSION" --option assetRegex="kubens.*"
26+
"ghcr.io/devcontainers-contrib/features/gh-release:1.0.18" \
27+
--option repo='ahmetb/kubectx' --option binaryNames='kubens' --option assetRegex='kubens.*' --option version="$VERSION"
28+
29+
30+
31+
echo 'Done!'
3232

33-
echo "Done!"

src/kubectx-kubens/library_scripts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
clean_download() {
5-
# The purpose of this function is to download a file with minimal impact on contaier layer size
5+
# The purpose of this function is to download a file with minimal impact on container layer size
66
# this means if no valid downloader is found (curl or wget) then we install a downloader (currently wget) in a
77
# temporary manner, and making sure to
88
# 1. uninstall the downloader at the return of the function

test/direnv/scenarios.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"test": {
2+
"test_defaults_debian": {
33
"image": "mcr.microsoft.com/devcontainers/base:debian",
44
"features": {
55
"direnv": {}
File renamed without changes.

test/kubectx-kubens/test.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#!/bin/bash
1+
#!/bin/bash -i
22

33
set -e
44

55
source dev-container-features-test-lib
66

7-
# we are simply checking version for now.
8-
# full operability depends on the existance of kubectl.
9-
check "kubectx version" kubectx --version
10-
check "kubens version" kubens --version
7+
check "kubectx --version" kubectx --version
8+
9+
check "kubens --version" kubens --version
1110

1211
reportResults

0 commit comments

Comments
 (0)