Skip to content

Commit

Permalink
feat: add x-arch builds for arm64 and amd64, remove assumption of run…
Browse files Browse the repository at this point in the history
…ning on amd64

Signed-off-by: Jonah Back <[email protected]>
  • Loading branch information
backjo committed Jan 21, 2021
1 parent 7af5837 commit 3518a07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ RUN make argocd-all
ARG BUILD_ALL_CLIS=true
RUN if [ "$BUILD_ALL_CLIS" = "true" ] ; then \
make BIN_NAME=argocd-darwin-amd64 GOOS=darwin argocd-all && \
make BIN_NAME=argocd-windows-amd64.exe GOOS=windows argocd-all \
make BIN_NAME=argocd-windows-amd64.exe GOOS=windows argocd-all && \
make BIN_NAME=argocd-linux-amd64 GOOS=linux GOARCH=amd64 argocd-all && \
make BIN_NAME=argocd-linux-arm64 GOOS=linux GOARCH=arm64 argocd-all \
; fi

####################################################################################################
Expand All @@ -139,4 +141,4 @@ RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex

USER 999
USER 999
14 changes: 11 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,20 @@ func newRedirectServer(port int, rootPath string) *http.Server {
// registerDownloadHandlers registers HTTP handlers to support downloads directly from the API server
// (e.g. argocd CLI)
func registerDownloadHandlers(mux *http.ServeMux, base string) {
linuxPath, err := exec.LookPath("argocd")
linuxAmdPath, err := exec.LookPath("argocd-linux-amd64")
if err != nil {
log.Warnf("argocd not in PATH")
log.Warnf("argocd-linux-amd64 not in PATH")
} else {
mux.HandleFunc(base+"/argocd-linux-amd64", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, linuxPath)
http.ServeFile(w, r, linuxAmdPath)
})
}
linuxArmPath, err := exec.LookPath("argocd-linux-arm64")
if err != nil {
log.Warnf("argocd-linux-arm64 not in PATH")
} else {
mux.HandleFunc(base+"/argocd-linux-arm64", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, linuxArmPath)
})
}
darwinPath, err := exec.LookPath("argocd-darwin-amd64")
Expand Down

0 comments on commit 3518a07

Please sign in to comment.