You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/11/08 18:53:04 UTC

[GitHub] [trafficcontrol] ericholguin opened a new pull request, #7180: Add go mod vendor to t3c run.sh

ericholguin opened a new pull request, #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180

   <!--
   Thank you for contributing! Please be sure to read our contribution guidelines: https://github.com/apache/trafficcontrol/blob/master/CONTRIBUTING.md
   If this closes or relates to an existing issue, please reference it using one of the following:
   
   Closes: #ISSUE
   Related: #ISSUE
   
   If this PR fixes a security vulnerability, DO NOT submit! Instead, contact
   the Apache Traffic Control Security Team at security@trafficcontrol.apache.org and follow the
   guidelines at https://apache.org/security regarding vulnerability disclosure.
   -->
   
   Adds the `go mod vendor` command to the t3c `run.sh` file, for when a user has a clean repo t3c won't fail to start up due to missing packages
   
   <!-- **^ Add meaningful description above** --><hr/>
   
   ## Which Traffic Control components are affected by this PR?
   <!-- Please delete all components from this list that are NOT affected by this PR.
   Feel free to add the name of a tool or script that is affected but not on the list.
   -->
   
   - Dev CDN in a Box
   
   ## What is the best way to verify this PR?
   <!-- Please include here ALL the steps necessary to test your PR.
   If your PR has tests (and most should), provide the steps needed to run the tests.
   If not, please provide step-by-step instructions to test the PR manually and explain why your PR does not need tests. -->
   
   Have a clean repo 
   ```shellsession
   cd dev/
   source atc.dev.sh
   atc build
   atc start
   ```
   
   Should find that t3c starts correctly
   
   
   ## PR submission checklist
   - [ ] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. -->
   - [ ] This PR has documentation <!-- If not, please delete this text and explain why this PR does not need documentation. -->
   - [ ] This PR has a CHANGELOG.md entry <!-- A fix for a bug from an ATC release, an improvement, or a new feature should have a changelog entry. -->
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://apache.org/security) for details)
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   


-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1019422562


##########
dev/atc.dev.sh:
##########
@@ -15,10 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-alias atc-start="docker-compose up -d --build";
 alias atc-build="docker-compose build";
 alias atc-stop="docker-compose kill && docker-compose down -v --remove-orphans";
 
+function atc-start {
+	if [ ! -d "vendor/golang/x" ]; then
+		go mod vendor
+	fi
+	docker-compose up -d --build

Review Comment:
   If `atc-build` is run before `docker-compose up`, `go mod vendor` can be run in a container so the user doesn't need `go` (or the latest `go` version)



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1019454714


##########
dev/atc.dev.sh:
##########
@@ -15,10 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-alias atc-start="docker-compose up -d --build";
 alias atc-build="docker-compose build";
 alias atc-stop="docker-compose kill && docker-compose down -v --remove-orphans";
 
+function atc-start {
+	if [ ! -d "vendor/golang/x" ]; then
+		go mod vendor
+	fi
+	docker-compose up -d --build

Review Comment:
   so, `go mod vendor` would go between `docker-compose build` and `docker-compose up`



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1019454222


##########
dev/atc.dev.sh:
##########
@@ -15,10 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-alias atc-start="docker-compose up -d --build";
 alias atc-build="docker-compose build";
 alias atc-stop="docker-compose kill && docker-compose down -v --remove-orphans";
 
+function atc-start {
+	if [ ! -d "vendor/golang/x" ]; then
+		go mod vendor
+	fi
+	docker-compose up -d --build

Review Comment:
   Nah, running `go mod vendor` from one of the docker-compose services using `docker-compose run`



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1017012943


##########
dev/t3c/run.sh:
##########
@@ -20,6 +20,9 @@
 set -o errexit
 trap '[ $? -eq 0 ] && exit 0 || echo "Error on line ${LINENO} of ${0}"; exit 1' EXIT
 
+cd $TC
+go mod vendor

Review Comment:
   `go mod vendor` removes all the contents of the `vendor` directory and re-adds them, so we shouldn't run `go mod vendor` unless it's actually needed.
   
   Everything in the `vendor` directory is tracked in git except for `vendor/golang.org/x`, so maybe only run `go mod vendor` if that directory doesn't exist?



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] ericholguin commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
ericholguin commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1019552146


##########
dev/atc.dev.sh:
##########
@@ -15,10 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-alias atc-start="docker-compose up -d --build";
 alias atc-build="docker-compose build";
 alias atc-stop="docker-compose kill && docker-compose down -v --remove-orphans";
 
+function atc-start {
+	if [ ! -d "vendor/golang/x" ]; then
+		go mod vendor
+	fi
+	docker-compose up -d --build

Review Comment:
   Not sure I understand, but if you want to just add it to your open PR: #7142 I can close this and review that.



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] ericholguin commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
ericholguin commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1019452292


##########
dev/atc.dev.sh:
##########
@@ -15,10 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-alias atc-start="docker-compose up -d --build";
 alias atc-build="docker-compose build";
 alias atc-stop="docker-compose kill && docker-compose down -v --remove-orphans";
 
+function atc-start {
+	if [ ! -d "vendor/golang/x" ]; then
+		go mod vendor
+	fi
+	docker-compose up -d --build

Review Comment:
   So run go mod vendor in the traffic ops Dockerfile?



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

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


[GitHub] [trafficcontrol] ericholguin commented on a diff in pull request #7180: Add go mod vendor to t3c run.sh

Posted by GitBox <gi...@apache.org>.
ericholguin commented on code in PR #7180:
URL: https://github.com/apache/trafficcontrol/pull/7180#discussion_r1019381682


##########
dev/t3c/run.sh:
##########
@@ -20,6 +20,9 @@
 set -o errexit
 trap '[ $? -eq 0 ] && exit 0 || echo "Error on line ${LINENO} of ${0}"; exit 1' EXIT
 
+cd $TC
+go mod vendor

Review Comment:
   I added the check and action to the atc.dev.sh script instead, as that should exist before the components are started without the components needed to check for it or wait on 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: issues-unsubscribe@trafficcontrol.apache.org

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