devcontainers-contrib / features

🐳 Extra add-in features for Devcontainers and GitHub Codespaces
MIT License
215 stars 113 forks source link

[Bug]: tfcdk-cli version value other than latest breaks build #484

Open fex01 opened 1 year ago

fex01 commented 1 year ago

Feature id and version

ghcr.io/devcontainers-contrib/features/tfcdk-cli:1.0.1

Devcontainer base Image

mcr.microsoft.com/devcontainers/base:bullseye

What happened?

Setting a value for version other than latest (for example 0.17.0) breaks the container build. The reason seems to be that the version number is appended instead of replacing the string latest: #0 13.80 npm ERR! Invalid tag name "latest@0.17.0" of package "cdktf-cli@latest@0.17.0": Tags may not have any characters that encodeURIComponent encodes..

devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
    "name": "WS_CDKTF_Python",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/base:bullseye",

    // Features to add to the dev container. More info: https://containers.dev/features.
    "features": {
        ...
        "ghcr.io/devcontainers-contrib/features/tfcdk-cli:1": {
                        "version": "0.17.0"
        },
        ...
    },
       ...
}

Relevant log output

=> ERROR [dev_containers_target_stage  9/18] RUN --mount=type=bind,from  14.2s
------
 > [dev_containers_target_stage  9/18] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=tfcdk-cli_11,target=/tmp/build-features-src/tfcdk-cli_11     cp -ar /tmp/build-features-src/tfcdk-cli_11 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/tfcdk-cli_11  && cd /tmp/dev-container-features/tfcdk-cli_11  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/tfcdk-cli_11:
#0 0.105 ===========================================================================
#0 0.105 Feature       : Terraform CDK CLI (via npm)
#0 0.105 Description   : Cloud Development Kit for Terraform (CDKTF) allows you to use familiar programming languages to define and provision infrastructure. This gives you access to the entire Terraform ecosystem without learning HashiCorp Configuration Language (HCL) and lets you leverage the power of your existing toolchain for testing, dependency management, etc.
#0 0.105 Id            : ghcr.io/devcontainers-contrib/features/tfcdk-cli
#0 0.105 Version       : 1.0.1
#0 0.105 Documentation : http://github.com/devcontainers-contrib/features/tree/main/src/tfcdk-cli
#0 0.105 Options       :
#0 0.105     VERSION="0.17.0"
#0 0.105 ===========================================================================
#0 0.107 bash: cannot set terminal process group (1): Inappropriate ioctl for device
#0 0.107 bash: no job control in this shell
#0 1.451 nanolayer
#0 4.762 cd /tmp/tmpa76wp63l && chmod +x -R . && _REMOTE_USER="vscode" _REMOTE_USER_HOME="/home/vscode" PACKAGE="cdktf-cli@latest" VERSION="0.17.0" NANOLAYER_VERBOSE="" NANOLAYER_FORCE_CLI_INSTALLATION="" NANOLAYER_PROPAGATE_CLI_LOCATION="1" NANOLAYER_CLI_LOCATION="/tmp/nanolayer-qygosF8rTU/nanolayer" bash  -i  +H ./install.sh
#0 4.762 Installing node and npm...
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
Get:3 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:5 https://dl.yarnpkg.com/debian stable/main arm64 Packages [10.9 kB]
Get:6 https://dl.yarnpkg.com/debian stable/main all Packages [10.9 kB]
Get:7 http://deb.debian.org/debian bullseye/main arm64 Packages [8071 kB]
Get:8 http://deb.debian.org/debian-security bullseye-security/main arm64 Packages [242 kB]
Get:9 http://deb.debian.org/debian bullseye-updates/main arm64 Packages [12.1 kB]
Fetched 8572 kB in 1s (7354 kB/s)                           
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
#0 7.078 Recommended packages:
#0 7.078   nodejs
#0 7.091 The following NEW packages will be installed:
#0 7.091   yarn
#0 7.093 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
#0 7.093 Need to get 893 kB of archives.
#0 7.093 After this operation, 5415 kB of additional disk space will be used.
Get:1 https://dl.yarnpkg.com/debian stable/main arm64 yarn all 1.22.19-1 [893 kB]
Fetched 893 kB in 0s (5609 kB/s)
#0 7.673 Selecting previously unselected package yarn.
(Reading database ... 25619 files and directories currently installed.)
#0 7.683 Preparing to unpack .../yarn_1.22.19-1_all.deb ...
#0 7.684 Unpacking yarn (1.22.19-1) ...
#0 7.761 Setting up yarn (1.22.19-1) ...
#0 7.997 => Downloading nvm from git to '/usr/local/share/nvm'
=> Cloning into '/usr/local/share/nvm'...
#0 8.611 remote: Enumerating objects: 360, done.        
remote: Counting objects: 100% (360/360), done.        
remote: Compressing objects: 100% (306/306), done.        
remote: Total 360 (delta 40), reused 170 (delta 28), pack-reused 0        
Receiving objects: 100% (360/360), 219.85 KiB | 4.23 MiB/s, done.
Resolving deltas: 100% (40/40), done.)
#0 9.508 * (HEAD detached at FETCH_HEAD)
#0 9.508   master
#0 9.511 => Compressing and cleaning up git repository
#0 9.515 
#0 9.519 => Profile not found. Tried  (as defined in $PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zprofile, ~/.zshrc, and ~/.profile.
#0 9.519 => Create one of them and run this script again
#0 9.519    OR
#0 9.519 => Append the following lines to the correct file yourself:
#0 9.519 
#0 9.519 export NVM_DIR="/usr/local/share/nvm"
#0 9.519 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
#0 9.519 
#0 9.542 => Installing Node.js version lts/*
#0 9.775 Downloading and installing node v18.16.1...
#0 9.925 Downloading https://nodejs.org/dist/v18.16.1/node-v18.16.1-linux-arm64.tar.xz...
######################################################################## 100.0%
#0 10.39 Computing checksum with sha256sum
#0 10.47 Checksums matched!
#0 12.24 Now using node v18.16.1 (npm v9.5.1)
#0 12.39 Creating default alias: default -> lts/* (-> v18.16.1 *)
#0 12.49 => Node.js version lts/* has been successfully installed
#0 12.49 => Close and reopen your terminal to start using nvm or run the following to use it now:
#0 12.49 
#0 12.49 export NVM_DIR="/usr/local/share/nvm"
#0 12.49 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
#0 12.76 default -> lts/* (-> v18.16.1 *)
#0 12.76 Updating /etc/bash.bashrc and /etc/zsh/zshrc...
#0 12.78 Skip installing pnpm because npm is missing
#0 12.78 Verifying node-gyp OS requirements...
#0 12.95 nvm cache cleared.
#0 12.98 Done!
#0 13.80 npm ERR! code EINVALIDTAGNAME
#0 13.80 npm ERR! Invalid tag name "latest@0.17.0" of package "cdktf-cli@latest@0.17.0": Tags may not have any characters that encodeURIComponent encodes.
#0 13.80 
#0 13.80 npm ERR! A complete log of this run can be found in:
#0 13.80 npm ERR!     /root/.npm/_logs/2023-06-29T07_26_16_800Z-debug-0.log
#0 13.80 Traceback (most recent call last):
#0 13.86   File "<string>", line 1, in <module>
#0 13.86   File "nanolayer.__main__", line 50, in main
#0 13.86   File "typer.main", line 328, in __call__
#0 13.86   File "typer.main", line 311, in __call__
#0 13.86   File "click.core", line 1130, in __call__
#0 13.86   File "typer.core", line 778, in main
#0 13.86   File "typer.core", line 216, in _main
#0 13.86   File "click.core", line 1657, in invoke
#0 13.86   File "click.core", line 1657, in invoke
#0 13.86   File "click.core", line 1404, in invoke
#0 13.86   File "click.core", line 760, in invoke
#0 13.86   File "typer.main", line 683, in wrapper
#0 13.86   File "nanolayer.cli.install", line 65, in install_devcontainer_feature
#0 13.86   File "nanolayer.installers.devcontainer_feature.oci_feature_installer", line 134, in install
#0 13.86   File "nanolayer.utils.invoker", line 56, in invoke
#0 13.86 nanolayer.utils.invoker.Invoker.InvokerException: The command 'cd /tmp/tmpa76wp63l && chmod +x -R . && _REMOTE_USER="vscode" _REMOTE_USER_HOME="/home/vscode" PACKAGE="cdktf-cli@latest" VERSION="0.17.0" NANOLAYER_VERBOSE="" NANOLAYER_FORCE_CLI_INSTALLATION="" NANOLAYER_PROPAGATE_CLI_LOCATION="1" NANOLAYER_CLI_LOCATION="/tmp/nanolayer-qygosF8rTU/nanolayer" bash  -i  +H ./install.sh' failed. error: Return Code: 1. see logs for details.
#0 14.01 ERROR: Feature "Terraform CDK CLI (via npm)" (ghcr.io/devcontainers-contrib/features/tfcdk-cli) failed to install! Look at the documentation at http://github.com/devcontainers-contrib/features/tree/main/src/tfcdk-cli for help troubleshooting this error.
------
Dockerfile.extended:60
--------------------
  59 |     
  60 | >>> RUN --mount=type=bind,from=dev_containers_feature_content_source,source=tfcdk-cli_11,target=/tmp/build-features-src/tfcdk-cli_11 \
  61 | >>>     cp -ar /tmp/build-features-src/tfcdk-cli_11 /tmp/dev-container-features \
  62 | >>>  && chmod -R 0755 /tmp/dev-container-features/tfcdk-cli_11 \
  63 | >>>  && cd /tmp/dev-container-features/tfcdk-cli_11 \
  64 | >>>  && chmod +x ./devcontainer-features-install.sh \
  65 | >>>  && ./devcontainer-features-install.sh \
  66 | >>>  && rm -rf /tmp/dev-container-features/tfcdk-cli_11
  67 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cp -ar /tmp/build-features-src/tfcdk-cli_11 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/tfcdk-cli_11  && cd /tmp/dev-container-features/tfcdk-cli_11  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/tfcdk-cli_11" did not complete successfully: exit code: 1
[24760 ms] Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/nv/pp7kflls789brz1v4r63sxhw0000gn/T/devcontainercli/container-features/0.42.0-1688023553347 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/base:bullseye --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-ws-cdktf-python-61b4e39198fccad39ad73015cd9cf30b6ff6aec765642294c774bec4971eb90d-features -f /var/folders/nv/pp7kflls789brz1v4r63sxhw0000gn/T/devcontainercli/container-features/0.42.0-1688023553347/Dockerfile.extended /Users/felix/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
danielbraun89 commented 1 year ago

@fex01 Thanks for reporting this! fixed in PR #485 In the same PR an new test has been added to verify version selection keep working properly please try: ghcr.io/devcontainers-contrib/features/tfcdk-cli:1.0.2