-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: support devcontainer #11765
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
base: master
Are you sure you want to change the base?
feat: support devcontainer #11765
Conversation
I have tested this on However, I don't have a desktop system running Linux, which would require someone else to help test, but that should not be a problem. |
The error in the CI is not related to this PR, it also fails on other PRs, will investigate it later. UPDATEI have fixed the issue in #11769. |
5533908
to
44bc599
Compare
🆒 I will help with testing using Manjaro KDE Plasma(amd64) + Docker Engine. |
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions. |
This PR has been renovated, where the tests can run correctly, except for a problem that needs to be solved by #12070. |
Merging the master branch to fix #12070 doesn't seem to be successful, I'll rebase and force push. |
Co-authored-by: SkyeYoung <iskyex@outlook.com>
cf3b2f4
to
183ad13
Compare
.devcontainer/Dockerfile
Outdated
&& rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz && rm -rf /tmp/etcd-download-test \ | ||
&& rm -rf /tmp/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe u can use rm -rf dir1 dir2 ...
.devcontainer/devcontainer.json
Outdated
"service": "apisix", | ||
"workspaceFolder": "/workspace", | ||
"privileged": true, | ||
"postCreateCommand": "bash -c 'cd /workspace && rm -rf test-nginx && git config --global --add safe.directory /workspace && git submodule update --init --recursive && git clone https://github.com/openresty/test-nginx.git --depth 1 && make deps'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u can try sth like git clone --depth 1 --single-branch --branch main
|
||
::: | ||
|
||
Wait some minutes, depending on the internet connection or computer performance, it may take from a few minutes to tens of minutes, you can click on the Progress Bar in the bottom right corner to view a live log where you will be able to check unusual stuck. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait some minutes, depending on the internet connection or computer performance, it may take from a few minutes to tens of minutes, you can click on the Progress Bar in the bottom right corner to view a live log where you will be able to check unusual stuck. | |
Wait some minutes, depending on the internet connection or computer performance, it may take from a few minutes to tens of minutes, you can click on the Progress Bar in the bottom right corner to view a live log where you will be able to check unusual stuck. | |
If you encounter any problems, you can search or ask questions in [GitHub Issues](https://github.com/apache/apisix/issues) or [GitHub Discussions](https://github.com/apache/apisix/discussions), and community members will respond as promptly as possible. |
make test | ||
|
||
# or run a specify test case file | ||
TEST_NGINX_BINARY=openresty FLUSH_ETCD=1 prove -Itest-nginx/lib -I. -r t/admin/api.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make test | |
# or run a specify test case file | |
TEST_NGINX_BINARY=openresty FLUSH_ETCD=1 prove -Itest-nginx/lib -I. -r t/admin/api.t | |
export TEST_NGINX_BINARY=openresty | |
# run all tests | |
make test | |
# or run a specify test case file | |
FLUSH_ETCD=1 prove -Itest-nginx/lib -I. -r t/admin/api.t |
make test
requires TEST_NGINX_BINARY
.
|
||
It will be on your host, which is where you cloned the APISIX source code, and the container uses the volume to mount the code into the container. Containers contain only the runtime environment, not the source code, so no changes will be lost whether you close or delete the container. | ||
|
||
And, the git is already installed in the container, so you can commit a change directly there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, the git is already installed in the container, so you can commit a change directly there. | |
And, the `git` is already installed in the container, so you can commit a change directly there. |
Description
Add devcontainer support to the project, which is expected to cover
Linux, Windows (WSL2), macOS
OSs, and theamd64, arm64
CPU ISAs, i.e. the environments used by most developers.Basically, the container provides an isolated environment from the host, the runtime and toolset required for APISIX development are built in the container build, they will be available out of the box and developers no longer need to build and install them on the host. Just start dev container, wait a few moments, and it's ready to go.
Significantly simplify the parts that may be unfamiliar to developers and just focus on writing Lua code and test cases.
In addition to this, etcd is ready, maintained by docker-compose, and accessible on the local loopback.
Checklist