You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/04 02:55:34 UTC

[GitHub] [apisix-ingress-controller] zaunist opened a new pull request, #1213: feat: support docker-compose command detect

zaunist opened a new pull request, #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213

   <!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   <!-- Please delete options that are not relevant. -->
   
   - [ ] Bugfix
   - [x] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   ### What this PR does / why we need it:
   
   fix https://github.com/apache/apisix-ingress-controller/issues/1201
   
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the requirements:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. Use "request review" to notify the reviewer once you have resolved the review
   -->
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix-ingress-controller#community) first**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] lingsamuel commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
lingsamuel commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r945592442


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   ```bash
   cmd=( docker compose )
   ```



##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   ```bash
   cmd=( docker compose )
   
   $cmd
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r939470991


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   Due to  the `compose` is a subcommand of `docker`, a form like this would be wrong, 
   
   ```
   cmd='docker compose'
   $cmd xxx
   ```
   
   e.g.
   
   ```
   ~                                                                                                                     ⍉
   ▶ cm='docker compose'
   
   ~
   ▶ $cm version
   zsh: command not found: docker compose
   
   ~                                                                                                                     ⍉
   ▶ eval $cm version
   Docker Compose version v2.7.0
   
   ```
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r937309739


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -21,6 +21,11 @@ cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
 
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, please install docker-compose"

Review Comment:
   
   If so, we need to write both docker compose and docker-compose logic, which would be too cumbersome, and I noticed that docker compose is only integrated in docker desktop for Windows and Mac OS, not for Linux systems. 
   
    Ref https://github.com/docker/compose#windows-and-macos



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] Chever-John commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
Chever-John commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r937307201


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -21,6 +21,11 @@ cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
 
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, please install docker-compose"

Review Comment:
   I don't think it should be resolved that way. We should write more judgments, because my current situation is that I only have the `docker compose` command, not `docker-compose`, and I just need to replace `docker-compose` with `docker compose`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#issuecomment-1249019549

   I don't have time to update the code


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r937319774


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -21,6 +21,11 @@ cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
 
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, please install docker-compose"

Review Comment:
   > 
   
   agree



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] codecov-commenter commented on pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#issuecomment-1204700612

   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1213?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1213](https://codecov.io/gh/apache/apisix-ingress-controller/pull/1213?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e4c7d5a) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/cccad72a1e0ef60525c69371b4b27c4598c587c1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cccad72) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head e4c7d5a differs from pull request most recent head cf118b7. Consider uploading reports for the commit cf118b7 to get more accurate results
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1213   +/-   ##
   =======================================
     Coverage   29.55%   29.55%           
   =======================================
     Files          81       81           
     Lines       10166    10166           
   =======================================
     Hits         3005     3005           
     Misses       6834     6834           
     Partials      327      327           
   ```
   
   
   
   :mega: Codecov can now indicate which changes are the most critical in Pull Requests. [Learn more](https://about.codecov.io/product/feature/runtime-insights/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] Chever-John commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
Chever-John commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r937312618


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -21,6 +21,11 @@ cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
 
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, please install docker-compose"

Review Comment:
   It is not necessary to ah, define a global variable. If `docker-compose` exists, copy `docker-compose` to this variable. If not, continue to determine if `docker compose` exists, and if it does, assign `docker compose` to this variable. 
   
   Finally, replace the original `docker-compose` globally.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r939157245


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   We don't need "eval"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist closed pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist closed pull request #1213: feat: support docker-compose command detect
URL: https://github.com/apache/apisix-ingress-controller/pull/1213


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] Chever-John commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
Chever-John commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r937307201


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -21,6 +21,11 @@ cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
 
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, please install docker-compose"

Review Comment:
   I don't think it should be resolved that way. We should write more judgments, because my current situation is that I only have the `docker compose` command, not `docker-compose`, and I just need to replace `docker-compose` with `docker compose`. Then everything is OK~
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r939471051


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   If we don't use eval, is there a better way to do it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r939853972


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   @Chever-John What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] zaunist commented on a diff in pull request #1213: feat: support docker-compose command detect

Posted by GitBox <gi...@apache.org>.
zaunist commented on code in PR #1213:
URL: https://github.com/apache/apisix-ingress-controller/pull/1213#discussion_r947752188


##########
test/e2e/testdata/wolf-rbac/cmd.sh:
##########
@@ -20,20 +20,26 @@
 cd test/e2e/testdata/wolf-rbac/
 
 OPTION=$1
+COMPOSE="docker-compose"
+
+if  ! command -v "docker-compose" > /dev/null; then
+	echo "docker-compose not found, try docker compose"
+    COMPOSE="docker compose"
+fi
 
 if  [ $OPTION = "ip" ]; then
     echo -n `docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' wolf-server`
 elif [ $OPTION = "start" ]; then
-    docker-compose -f 'docker-compose.yaml'  -p 'wolf-rbac' down
+    eval "$COMPOSE -f 'docker-compose.yaml'  -p 'wolf-rbac' down"

Review Comment:
   > ```shell
   > cmd=( docker compose )
   > 
   > $cmd
   > ```
   
   This method doesn't work. I can't think of any other way than eval.
   
   <img width="663" alt="image" src="https://user-images.githubusercontent.com/38528079/185095182-46fc76ae-5e62-464e-b113-9cbf9b53a29a.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org