Skip to content

Commit

Permalink
feat(server): Argo Server. Closes argoproj#1331 (argoproj#1882)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec authored and sarabala1979 committed Jan 15, 2020
1 parent f69655a commit 14d5803
Show file tree
Hide file tree
Showing 327 changed files with 41,942 additions and 8,796 deletions.
74 changes: 0 additions & 74 deletions .argo-ci/ci.yaml

This file was deleted.

52 changes: 33 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ commands:
- restore_cache:
name: Restore vendor cache
keys:
- vendor-v2-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_JOB }}
- vendor-v1-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_JOB }}
- vendor-v6-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_JOB }}
- run:
name: Ensure dependencies
command: dep ensure -v
command: |
# dep ensure takes 5m, but is only needed if not cached
[[ -e vendor ]] || make vendor && touch vendor
- save_cache:
name: Save vendor cache
key: vendor-v2-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_JOB }}
key: vendor-v6-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- vendor
when: always
install_golang:
steps:
- run:
Expand All @@ -31,18 +33,20 @@ commands:
steps:
- save_cache:
name: Save Golang cache
key: go-v1-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
# https://circleci.com/docs/2.0/language-go/
key: go-v5-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
paths:
- /home/circleci/.cache/go-build
- /home/circleci/sdk/go1.12.6
when: always
restore_go_cache:
steps:
- restore_cache:
name: Restore Golang cache
keys:
- go-v1-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
- go-v1-master-{{ .Environment.CIRCLE_JOB }}
- go-v5-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
- go-v5-master-{{ .Environment.CIRCLE_JOB }}
- go-v4-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
- go-v4-master-{{ .Environment.CIRCLE_JOB }}
go_junit_report:
steps:
- run:
Expand All @@ -52,7 +56,7 @@ jobs:
test:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: circleci/classic:201808-01
image: ubuntu-1604:201903-01
steps:
- restore_go_cache
- install_golang
Expand Down Expand Up @@ -80,8 +84,11 @@ jobs:
e2e:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: circleci/classic:201808-01
image: ubuntu-1604:201903-01
steps:
- run:
name: Install Kustomize
command: cd /usr/local/bin && curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | sudo bash
- run:
name: Install and start K3S v1.0.0
command: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.0.0 INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
Expand All @@ -103,14 +110,7 @@ jobs:
name: Create KUBECONFIG
command: |
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- run: KUBECONFIG=~/.kube/config make cli start-e2e
- run:
name: Follow controller logs, to help diagnose failures
command: |
sleep 10
make logs-e2e
background: true
cat /etc/rancher/k3s/k3s.yaml | sed "s/127.0.0.1/$(hostname)/g" > ~/.kube/config
- run:
name: Watch Docker events, to help diagnose failures
command: docker events
Expand All @@ -119,6 +119,20 @@ jobs:
name: Watch Kubernetes events, to help diagnose failures
command: kubectl -n argo get events --watch
background: true
- run:
name: Start Argo
command: mkdir dist && KUBECONFIG=~/.kube/config make start
- run:
name: Establish port forward
command: make pf
background: true
- run:
name: Follow logs, to help diagnose failures
command: make logs
background: true
- run:
name: Run smoke tests
command: make smoke
- run:
name: Run tests
command: |
Expand Down Expand Up @@ -153,7 +167,7 @@ jobs:
# - run: ./node_modules/.bin/codecov -p ..
- run:
name: Build
command: NODE_ENV='production' yarn build
command: yarn build
- run:
name: Lint
command: yarn lint
Expand Down
11 changes: 11 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ignore:
- "cmd/server/static/files.go"
- "pkg/client"
coverage:
status:
# we've found this not to be useful
patch: off
project:
default:
# allow test coverage to drop by 2%, assume that it's typically due to CI problems
threshold: 2
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Prevent vendor directory from being copied to ensure we are not not pulling unexpected cruft from
# a user's workspace, and are only building off of what is locked by dep.
.git
vendor
.idea
assets
coverage.out
dist
vendor
ui/dist
ui/node_modules
14 changes: 14 additions & 0 deletions .github/workflows/dockerimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Docker Image CI

on: [push]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ dist/
# delve debug binaries
cmd/**/debug
hack/**/debug
/argo
/argoexec
/argo-server
debug.test
*.iml
coverage.out
/coverage.out
.envrc
/.vendor-new
/workflow-controller
14 changes: 14 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
run:
tests: false
deadline: 2m
skip-files:
- "cmd/server/static/files.go"
- "pkg/client"
- "vendor/"
- "ui/"
linters:
enable:
- goimports
linters-settings:
goimports:
local-prefixes: github.com/argoproj/argo
58 changes: 28 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ ENV DEP_VERSION=0.5.0
RUN wget https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -O /usr/local/bin/dep && \
chmod +x /usr/local/bin/dep

# Install golangci-lint
ENV GOLANGCI_LINT_VERSION=1.16.0
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/v$GOLANGCI_LINT_VERSION/install.sh| sh -s -- -b $(go env GOPATH)/bin v$GOLANGCI_LINT_VERSION

# Install gometalinter
# Keep gometalinter to avoid CI failures during the linter migration.
# We can remove it after enough time has passed.
ENV GOMETALINTER_VERSION=2.0.12
RUN curl -sLo- https://github.com/alecthomas/gometalinter/releases/download/v${GOMETALINTER_VERSION}/gometalinter-${GOMETALINTER_VERSION}-linux-amd64.tar.gz | \
tar -xzC "$GOPATH/bin" --exclude COPYING --exclude README.md --strip-components 1 -f- && \
ln -s $GOPATH/bin/gometalinter $GOPATH/bin/gometalinter.v2


####################################################################################################
# argoexec-base
# Used as the base for both the release and development version of argoexec
Expand All @@ -59,47 +46,58 @@ RUN apt-get update && \
COPY hack/ssh_known_hosts /etc/ssh/ssh_known_hosts
COPY --from=builder /usr/local/bin/docker /usr/local/bin/

####################################################################################################

FROM node:11.15.0 as argo-ui

ADD ["ui", "."]

RUN yarn install --frozen-lockfile --ignore-optional --non-interactive
RUN yarn build

####################################################################################################
# Argo Build stage which performs the actual build of Argo binaries
####################################################################################################
FROM builder as argo-build

# A dummy directory is created under $GOPATH/src/dummy so we are able to use dep
# to install all the packages of our dep lock file
COPY Gopkg.toml ${GOPATH}/src/dummy/Gopkg.toml
COPY Gopkg.lock ${GOPATH}/src/dummy/Gopkg.lock

RUN cd ${GOPATH}/src/dummy && \
dep ensure -vendor-only && \
mv vendor/* ${GOPATH}/src/ && \
rmdir vendor

# Perform the build
WORKDIR /go/src/github.com/argoproj/argo
COPY . .
ARG MAKE_TARGET="controller executor cli-linux-amd64"
RUN make $MAKE_TARGET

# stop the annoying git related error messages
RUN git init
RUN git remote add origin https://github.com/argoproj/argo.git
RUN git fetch --no-tags --depth=1 origin
COPY --from=argo-ui node_modules ui/node_modules
RUN mkdir -p ui/dist
COPY --from=argo-ui dist/app ui/dist/app
# stop make from trying to re-build this without yarn installed
RUN touch ui/dist/app
RUN make dist/argo-server-linux-amd64 dist/argo-linux-amd64 dist/workflow-controller-linux-amd64 dist/argoexec-linux-amd64 dist/argo-server-linux-amd64

####################################################################################################
# argoexec
####################################################################################################
FROM argoexec-base as argoexec
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argoexec /usr/local/bin/

COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argoexec-linux-amd64 /usr/local/bin/argoexec
ENTRYPOINT [ "argoexec" ]

####################################################################################################
# workflow-controller
####################################################################################################
FROM scratch as workflow-controller
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/workflow-controller /bin/
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/workflow-controller-linux-amd64 /bin/workflow-controller
ENTRYPOINT [ "workflow-controller" ]


####################################################################################################
# argocli
####################################################################################################
FROM scratch as argocli
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argo-linux-amd64 /bin/argo
ENTRYPOINT [ "argo" ]

####################################################################################################
# argo-server
####################################################################################################
FROM scratch as argo-server
COPY --from=argo-build /go/src/github.com/argoproj/argo/dist/argo-server-linux-amd64 /usr/local/bin/argo-server
ENTRYPOINT [ "argo-server" ]
5 changes: 0 additions & 5 deletions Dockerfile.argoexec-dev

This file was deleted.

Loading

0 comments on commit 14d5803

Please sign in to comment.