trafficcontrol icon indicating copy to clipboard operation
trafficcontrol copied to clipboard

Add realpath support to pkg

Open zrhoffman opened this issue 10 months ago • 6 comments

The pkg script (along with our build scripts) makes use of realpath. But as noticed in apache/trafficcontrol#7958, pkg does not have a backup realpath function if the host OS does not have realpath. apache/trafficcontrol#7981 adds a backup realpath function to the pkg script.


Which Traffic Control components are affected by this PR?

  • Build system
  • Automation
  • unknown

What is the best way to verify this PR?

Try building ATS or Traffic Portal v2 ./pkg vbo ats on macOS or another platform with realpath` at least temporarily removed

PR submission checklist

zrhoffman avatar Apr 03 '24 19:04 zrhoffman

r? @ntheanh201, @limited

zrhoffman avatar Apr 03 '24 19:04 zrhoffman

I still see that issue

./pkg -o -v -b ats

/bin/realpath
Building ats.
[+] Building 0.0s (17/17) FINISHED                                                                                                                                                                                 docker:orbstack
 => [ats internal] load build definition from Dockerfile-tsb                                                                                                                                                                  0.0s
 => => transferring dockerfile: 2.63kB                                                                                                                                                                                        0.0s
 => [ats internal] load metadata for docker.io/library/rockylinux:8                                                                                                                                                           0.0s
 => [ats internal] load .dockerignore                                                                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                                                                               0.0s
 => [ats internal] load build context                                                                                                                                                                                         0.0s
 => => transferring context: 31B                                                                                                                                                                                              0.0s
 => [ats tsb-build 1/6] FROM docker.io/library/rockylinux:8                                                                                                                                                                   0.0s
 => CACHED [ats stage-1 2/7] RUN YUM -y install git sudo                                                                                                                                                                      0.0s
 => CACHED [ats stage-1 3/7] RUN ECHO -e "#!/usr/bin/env bash\necho docker-compose is not supported in this container and the build command will not work.\nexit 1" > /usr/bin/docker-compose                                 0.0s
 => CACHED [ats stage-1 4/7] RUN CHMOD +x /usr/bin/docker-compose                                                                                                                                                             0.0s
 => CACHED [ats tsb-build 2/6] RUN yum clean all && yum -y install git &&  git config --global --add safe.directory '*'                                                                                                       0.0s
 => CACHED [ats tsb-build 3/6] COPY GO_VERSION /                                                                                                                                                                              0.0s
 => CACHED [ats tsb-build 4/6] RUN curl -L https://dl.google.com/go/go$(cat /GO_VERSION).linux-amd64.tar.gz | tar -C /usr/local -xz && ln -s /usr/local/go/bin/go /usr/bin/go                                                 0.0s
 => CACHED [ats tsb-build 5/6] RUN mkdir -p /go/src/github.com/comcast/tsb && cd /go/src/github.com/comcast/tsb && git init && git remote add origin https://github.com/comcast/tsb && git fetch --depth=1 origin 851be3e137  0.0s
 => CACHED [ats tsb-build 6/6] RUN cd /go/src/github.com/comcast/tsb && CGOENABLED=0 go build -o /usr/bin/tsb                                                                                                                 0.0s
 => CACHED [ats stage-1 5/7] COPY --FROM=TSB-BUILD /usr/bin/tsb /usr/bin/tsb                                                                                                                                                  0.0s
 => CACHED [ats stage-1 6/7] RUN GIT config --global user.email "[email protected]"                                                                                                                               0.0s
 => CACHED [ats stage-1 7/7] RUN GIT config --global user.name "Apache Traffic Control"                                                                                                                                       0.0s
 => [ats] exporting to image                                                                                                                                                                                                  0.0s
 => => exporting layers                                                                                                                                                                                                       0.0s
 => => writing image sha256:4ee81397cf7c5f790366fb08de0cdb72fff07b1419dfbcd0bef95e3868d56991                                                                                                                                  0.0s
 => => naming to docker.io/library/build-ats                                                                                                                                                                                  0.0s
WARN[0000] Found orphan containers ([build-traffic_stats_build-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
realpath: illegal option -- e
usage: realpath [-q] [path ...]
realpath: illegal option -- e
usage: realpath [-q] [path ...]
unknown flag: --services
/bin/realpath
Top-level object must be a mapping
Top-level object must be a mapping
Building /bin/realpath.
Failed to build /bin/realpath.
Results in 'dist':
total 0
Failed to build ats.
Results in 'dist':
total 0

ntheanh201 avatar Apr 04 '24 15:04 ntheanh201

Thanks! Removed the -e from realpath in commands in e39d13ac84.

zrhoffman avatar Apr 04 '24 15:04 zrhoffman

I still saw numerous failures on this

/bin/realpath
Building /bin/realpath.
Building weasel.
Building cache-config_build.
Building docs.
Building grove_build.
Building grovetccfg_build.
Building source.
Building tc-health-client_build.
Building traffic_monitor_build.
Building traffic_ops_build.
Building traffic_portal_build.
Building traffic_router_build.
Building traffic_stats_build.
Failed to build /bin/realpath traffic_ops_build traffic_portal_build traffic_router_build traffic_stats_build.
Results in 'dist':

limited avatar Apr 04 '24 18:04 limited

I still saw numerous failures on this

@limited Thanks for testing, I think it is fixed as of 7d82265d78e4. Care to retest?

zrhoffman avatar Apr 06 '24 05:04 zrhoffman

your new realpath of Docker compose is different than the old realpath, and I think that cause this problem:

Building ats_build.
[+] Building 0.0s (1/1) FINISHED                                                                                                                                                                                   docker:orbstack
 => [ats_build internal] load build definition from Dockerfile                                                                                                                                                                0.0s
 => => transferring dockerfile: 2B                                                                                                                                                                                            0.0s
failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory
Failed to build ats_build.
Results in 'dist':
total 0
Failed to build ats.
Results in 'dist':
total 0

ntheanh201 avatar Apr 06 '24 13:04 ntheanh201