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

Add option to install java to feature openapi-generator-cli #5

Merged
merged 5 commits into from
Sep 15, 2024
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: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
test-autogenerated:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- aws-ssm-session-manager-plugin
Expand All @@ -44,6 +45,7 @@ jobs:
test-scenarios:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- aws-ssm-session-manager-plugin
Expand Down
20 changes: 10 additions & 10 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Test current feature",
"type": "shell",
"command": "devcontainer features test --features \"$(basename ${fileDirname})\" --base-image ubuntu",
"group": "test",
"problemMatcher": []
}
]
"version": "2.0.0",
"tasks": [
{
"label": "Devcontainers: Test current feature",
"type": "shell",
"command": "devcontainer features test --features \"$(basename ${fileDirname})\" --base-image ubuntu",
"group": "test",
"problemMatcher": []
}
]
}
9 changes: 7 additions & 2 deletions src/openapi-generator-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"name": "OpenAPI Generator CLI",
"id": "openapi-generator-cli",
"version": "0.1.0",
"description": "A feature to install OpenAPI Generator CLI. Java is required but not included in this feature.",
"version": "0.2.0",
"description": "A feature to install OpenAPI Generator CLI.",
"options": {
"version": {
"type": "string",
"default": "latest",
"description": "The version of OpenAPI Generator CLI to install."
},
"install-java": {
"type": "boolean",
"default": false,
"description": "Whether to install Java (default-jre) via APT."
}
},
"installsAfter": [
Expand Down
5 changes: 5 additions & 0 deletions src/openapi-generator-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -e

apt-get update && apt-get install -y curl

if [ "$INSTALL_JAVA" = 'true' ]; then
echo "Installing default-jre as \$INSTALL_JAVA is set to true"
apt-get install -y default-jre
fi

if [ "$VERSION" = 'latest' ]; then
echo "Resolving latest version of OpenAPI Generator CLI"
VERSION=$(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
# shellcheck source=/dev/null
source dev-container-features-test-lib

check "verify Java installation" java --version | grep -Eo 'openjdk .+$'
check "verify OpenAPI Generator CLI installation" openapi-generator-cli --version | grep -Eo '^openapi-generator-cli .+$'

reportResults
7 changes: 4 additions & 3 deletions test/openapi-generator-cli/scenarios.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"latest": {
"latest-with-java": {
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": {
"ghcr.io/devcontainers/features/java:1": {},
"openapi-generator-cli": {}
"openapi-generator-cli": {
"install-java": true
}
}
},
"specific-version": {
Expand Down