Merge pull request #5392 from dokku/vscode-arm

Add support for devcontainers on ARM64 instances
This commit is contained in:
Jose Diaz-Gonzalez
2022-10-13 00:09:30 -04:00
committed by GitHub
4 changed files with 74 additions and 34 deletions

View File

@@ -7,8 +7,9 @@ RUN apt-get install --no-install-recommends -y build-essential file nano && \
apt-get autoremove --yes && \ apt-get autoremove --yes && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
RUN wget https://dl.google.com/go/go1.17.9.linux-amd64.tar.gz && \ ARG TARGETARCH
tar -xvf go1.17.9.linux-amd64.tar.gz && \ RUN wget https://dl.google.com/go/go1.17.9.linux-${TARGETARCH}.tar.gz && \
tar -xvf go1.17.9.linux-${TARGETARCH}.tar.gz && \
mv go /usr/local mv go /usr/local
RUN GOROOT=/usr/local/go /usr/local/go/bin/go install golang.org/x/tools/gopls@latest 2>&1 RUN GOROOT=/usr/local/go /usr/local/go/bin/go install golang.org/x/tools/gopls@latest 2>&1

View File

@@ -1,5 +1,7 @@
DOKKU_VERSION ?= master DOKKU_VERSION ?= master
TARGETARCH ?= amd64
DOCKER_IMAGE_LABELER_VERSION ?= 0.5.0 DOCKER_IMAGE_LABELER_VERSION ?= 0.5.0
HEROKUISH_VERSION ?= 0.5.37 HEROKUISH_VERSION ?= 0.5.37
LAMBDA_BUILDER_VERSION ?= 0.4.0 LAMBDA_BUILDER_VERSION ?= 0.4.0
@@ -8,12 +10,12 @@ PLUGN_VERSION ?= 0.12.0
PROCFILE_VERSION ?= 0.15.0 PROCFILE_VERSION ?= 0.15.0
SIGIL_VERSION ?= 0.9.0 SIGIL_VERSION ?= 0.9.0
SSHCOMMAND_VERSION ?= 0.16.0 SSHCOMMAND_VERSION ?= 0.16.0
DOCKER_IMAGE_LABELER_URL ?= https://github.com/dokku/docker-image-labeler/releases/download/v${DOCKER_IMAGE_LABELER_VERSION}/docker-image-labeler_${DOCKER_IMAGE_LABELER_VERSION}_linux_amd64.tgz DOCKER_IMAGE_LABELER_URL ?= https://github.com/dokku/docker-image-labeler/releases/download/v${DOCKER_IMAGE_LABELER_VERSION}/docker-image-labeler_${DOCKER_IMAGE_LABELER_VERSION}_linux_${TARGETARCH}.tgz
LAMBDA_BUILDER_URL ?= https://github.com/dokku/lambda-builder/releases/download/v${LAMBDA_BUILDER_VERSION}/lambda-builder_${LAMBDA_BUILDER_VERSION}_linux_amd64.tgz LAMBDA_BUILDER_URL ?= https://github.com/dokku/lambda-builder/releases/download/v${LAMBDA_BUILDER_VERSION}/lambda-builder_${LAMBDA_BUILDER_VERSION}_linux_${TARGETARCH}.tgz
NETRC_URL ?= https://github.com/dokku/netrc/releases/download/v${NETRC_VERSION}/netrc_${NETRC_VERSION}_linux_amd64.tgz NETRC_URL ?= https://github.com/dokku/netrc/releases/download/v${NETRC_VERSION}/netrc_${NETRC_VERSION}_linux_${TARGETARCH}.tgz
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v${PLUGN_VERSION}/plugn_${PLUGN_VERSION}_linux_amd64.tgz PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v${PLUGN_VERSION}/plugn_${PLUGN_VERSION}_linux_${TARGETARCH}.tgz
PROCFILE_UTIL_URL ?= https://github.com/josegonzalez/go-procfile-util/releases/download/v${PROCFILE_VERSION}/procfile-util_${PROCFILE_VERSION}_linux_amd64.tgz PROCFILE_UTIL_URL ?= https://github.com/josegonzalez/go-procfile-util/releases/download/v${PROCFILE_VERSION}/procfile-util_${PROCFILE_VERSION}_linux_${TARGETARCH}.tgz
SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v${SIGIL_VERSION}/gliderlabs-sigil_${SIGIL_VERSION}_linux_amd64.tgz SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v${SIGIL_VERSION}/gliderlabs-sigil_${SIGIL_VERSION}_linux_${TARGETARCH}.tgz
SSHCOMMAND_URL ?= https://github.com/dokku/sshcommand/releases/download/v${SSHCOMMAND_VERSION}/sshcommand_${SSHCOMMAND_VERSION}_linux_x86_64.tgz SSHCOMMAND_URL ?= https://github.com/dokku/sshcommand/releases/download/v${SSHCOMMAND_VERSION}/sshcommand_${SSHCOMMAND_VERSION}_linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git STACK_URL ?= https://github.com/gliderlabs/herokuish.git
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest-20 PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest-20
@@ -157,32 +159,32 @@ man-db:
docker-image-labeler: docker-image-labeler:
wget -qO /tmp/docker-image-labeler_latest.tgz ${DOCKER_IMAGE_LABELER_URL} wget -qO /tmp/docker-image-labeler_latest.tgz ${DOCKER_IMAGE_LABELER_URL}
tar xzf /tmp/docker-image-labeler_latest.tgz -C /usr/local/bin tar xzf /tmp/docker-image-labeler_latest.tgz -C /usr/local/bin
mv /usr/local/bin/docker-image-labeler-amd64 /usr/local/bin/docker-image-labeler mv /usr/local/bin/docker-image-labeler-${TARGETARCH} /usr/local/bin/docker-image-labeler
lambda-builder: lambda-builder:
wget -qO /tmp/lambda-builder_latest.tgz ${LAMBDA_BUILDER_URL} wget -qO /tmp/lambda-builder_latest.tgz ${LAMBDA_BUILDER_URL}
tar xzf /tmp/lambda-builder_latest.tgz -C /usr/local/bin tar xzf /tmp/lambda-builder_latest.tgz -C /usr/local/bin
mv /usr/local/bin/lambda-builder-amd64 /usr/local/bin/lambda-builder mv /usr/local/bin/lambda-builder-${TARGETARCH} /usr/local/bin/lambda-builder
netrc: netrc:
wget -qO /tmp/netrc_latest.tgz ${NETRC_URL} wget -qO /tmp/netrc_latest.tgz ${NETRC_URL}
tar xzf /tmp/netrc_latest.tgz -C /usr/local/bin tar xzf /tmp/netrc_latest.tgz -C /usr/local/bin
mv /usr/local/bin/netrc-amd64 /usr/local/bin/netrc mv /usr/local/bin/netrc-${TARGETARCH} /usr/local/bin/netrc
procfile-util: procfile-util:
wget -qO /tmp/procfile-util_latest.tgz ${PROCFILE_UTIL_URL} wget -qO /tmp/procfile-util_latest.tgz ${PROCFILE_UTIL_URL}
tar xzf /tmp/procfile-util_latest.tgz -C /usr/local/bin tar xzf /tmp/procfile-util_latest.tgz -C /usr/local/bin
mv /usr/local/bin/procfile-util-amd64 /usr/local/bin/procfile-util mv /usr/local/bin/procfile-util-${TARGETARCH} /usr/local/bin/procfile-util
plugn: plugn:
wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL} wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL}
tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
mv /usr/local/bin/plugn-amd64 /usr/local/bin/plugn mv /usr/local/bin/plugn-${TARGETARCH} /usr/local/bin/plugn
sigil: sigil:
wget -qO /tmp/sigil_latest.tgz ${SIGIL_URL} wget -qO /tmp/sigil_latest.tgz ${SIGIL_URL}
tar xzf /tmp/sigil_latest.tgz -C /usr/local/bin tar xzf /tmp/sigil_latest.tgz -C /usr/local/bin
mv /usr/local/bin/gliderlabs-sigil-amd64 /usr/local/bin/sigil mv /usr/local/bin/gliderlabs-sigil-${TARGETARCH} /usr/local/bin/sigil
sshcommand: sshcommand:
wget -qO /tmp/sshcommand_latest.tgz ${SSHCOMMAND_URL} wget -qO /tmp/sshcommand_latest.tgz ${SSHCOMMAND_URL}

View File

@@ -17,6 +17,8 @@ While we do provide official packages for a variety of platforms, as our test su
## Local Test Execution ## Local Test Execution
### Vagrant VM
- Setup Dokku in a [Vagrant VM](/docs/getting-started/install/vagrant.md). - Setup Dokku in a [Vagrant VM](/docs/getting-started/install/vagrant.md).
- Run the following to setup tests and execute them: - Run the following to setup tests and execute them:
@@ -25,18 +27,6 @@ While we do provide official packages for a variety of platforms, as our test su
sudo su - sudo su -
cd ~/dokku cd ~/dokku
make ci-dependencies setup-deploy-tests make ci-dependencies setup-deploy-tests
# execute the entire test suite (linter, bats tests, and app deployment tests)
make test
# run linter
make lint
# execute all bats tests
make unit-tests
# execute all app deployment tests
make deploy-tests
``` ```
After making changes to your local Dokku clone, don't forget to update the Vagrant Dokku install. After making changes to your local Dokku clone, don't forget to update the Vagrant Dokku install.
@@ -49,7 +39,54 @@ make copyfiles
make go-build-plugin copyplugin PLUGIN_NAME=apps make go-build-plugin copyplugin PLUGIN_NAME=apps
``` ```
Additionally you may run a specific app deployment tests with a target similar to: ### VSCode Dev Container
- Open Dokku in a VSCode DevContainer
- Run the following in the VSCode terminal to setup tests and execute them:
```shell
make ci-dependencies setup-deploy-tests
```
After making changes to your local Dokku clone, don't forget to update the Vagrant Dokku install.
```shell
# update vagrant dokku install from local git clone
make copyfiles
# build a specific plugin
make go-build-plugin copyplugin PLUGIN_NAME=apps
```
### Executing tests
Execute the entire test suite (linter, bats tests, and app deployment tests):
```shell
make test
```
Run the linter
```shell
make lint
```
Execute all bats tests
```shell
make unit-tests
```
Execute all app deployment tests
```shell
make deploy-tests
```
#### Executing App Tests
You may run a specific app deployment tests with a target similar to:
```shell ```shell
make deploy-test-nodejs-express make deploy-test-nodejs-express
@@ -57,32 +94,32 @@ make deploy-test-nodejs-express
For a full list of test make targets check out `tests.mk` in the root of the Dokku repository. For a full list of test make targets check out `tests.mk` in the root of the Dokku repository.
## Executing a single test suite #### Executing a single test suite
When working on a particular plugin, it may be useful to run _only_ a particular test suite. This can be done by specifying the test suite path: When working on a particular plugin, it may be useful to run _only_ a particular test suite. This can be done by specifying the test suite path:
```shell ```shell
bats tests/unit/10_apps.bats bats tests/unit/apps_1.bats
``` ```
It is also possible to target multiple test suites at a time. It is also possible to target multiple test suites at a time.
```shell ```shell
bats tests/unit/10_apps.bats tests/unit/10_certs.bats bats tests/unit/apps_1.bats tests/unit/certs.bats
``` ```
## Executing a single test #### Executing a single test
In order to increase testing velocity, a wrapper script around Bats is available that can be used to run a single test case within a suite. In order to increase testing velocity, a wrapper script around Bats is available that can be used to run a single test case within a suite.
Tests within a suite may be listed by specifying the suite as a parameter to `bats`. Tests within a suite may be listed by specifying the suite as a parameter to `bats`.
```shell ```shell
bats tests/unit/10_apps.bats bats tests/unit/apps_1.bats
``` ```
A single test can be specified via the `--filter` argument. The tests are selected via regex match, and all matches are executed. A single test can be specified via the `--filter` argument. The tests are selected via regex match, and all matches are executed.
```shell ```shell
bats --filter clone tests/unit/10_apps.bats bats --filter list tests/unit/apps_1.bats
``` ```

View File

@@ -26,7 +26,7 @@ ifneq ($(shell shfmt --version >/dev/null 2>&1 ; echo $$?),0)
ifeq ($(shfmt),Darwin) ifeq ($(shfmt),Darwin)
brew install shfmt brew install shfmt
else else
wget -qO /tmp/shfmt https://github.com/mvdan/sh/releases/download/v2.6.2/shfmt_v2.6.2_linux_amd64 wget -qO /tmp/shfmt https://github.com/mvdan/sh/releases/download/v3.5.1/shfmt_v3.5.1_linux_${TARGETARCH}
chmod +x /tmp/shfmt chmod +x /tmp/shfmt
sudo mv /tmp/shfmt /usr/local/bin/shfmt sudo mv /tmp/shfmt /usr/local/bin/shfmt
endif endif