Skip to content

Commit

Permalink
feat: Argo Rollouts api-server and UI (#1015)
Browse files Browse the repository at this point in the history
Signed-off-by: Remington Breeze <[email protected]>
  • Loading branch information
rbreeze authored Apr 9, 2021
1 parent 959a4a5 commit 7facfaa
Show file tree
Hide file tree
Showing 113 changed files with 59,968 additions and 708 deletions.
12 changes: 10 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ coverage:
default:
threshold: 0.1
ignore:
- "pkg/apis/rollouts/v1alpha1"
- "test"
- "pkg/apis/rollouts/v1alpha1"
- "test"
- "**/*.pb.go"
- "**/*.pb.gw.go"
- "**/*generated.go"
- "**/*generated.deepcopy.go"
- "**/*_test.go"
- "pkg/apis/client/.*"
- "pkg/client/.*"
- "vendor/.*"
126 changes: 90 additions & 36 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Go
on:
push:
branches:
- 'master'
- 'release-*'
- "master"
- "release-*"
pull_request:
branches:
- 'master'
- "master"
jobs:
lint-go:
name: Lint Go code
Expand All @@ -23,58 +23,112 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Restore go build cache
uses: actions/cache@v2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Restore go build cache
uses: actions/cache@v2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}

- name: Download all Go modules
run: |
go mod download
- name: Download all Go modules
run: |
go mod download
- name: Compile all packages
run: make controller plugin
- name: Compile all packages
run: make controller plugin

- name: Test
run: go test -failfast -covermode=count -coverprofile=coverage.out ./...
- name: Test
run: go test -failfast -covermode=count -coverprofile=coverage.out ./...

- name: Generate code coverage artifacts
uses: actions/upload-artifact@v2
with:
name: code-coverage
path: coverage.out
- name: Generate code coverage artifacts
uses: actions/upload-artifact@v2
with:
name: code-coverage
path: coverage.out

- name: Upload code coverage information to codecov.io
uses: codecov/codecov-action@v1
with:
file: coverage.out
- name: Upload code coverage information to codecov.io
uses: codecov/codecov-action@v1
with:
file: coverage.out

codegen:
name: Verify Codegen
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/go
PROTOC_ZIP: protoc-3.12.3-linux-x86_64.zip
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Download & vendor dependencies
go-version: 1.16.2
- uses: actions/cache@v2
with:
path: /home/runner/.cache/go-build
key: GOCACHE-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/pkg/mod
key: GOMODCACHE-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/bin
key: go-bin-v1-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: protoc-3.12.3-linux-x86_64.zip
key: protoc-3.12.3-linux-x86_64.zip
- name: Install protoc
run: |
set -eux -o pipefail
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
sudo chmod +x /usr/local/bin/protoc
sudo find /usr/local/include -type f | xargs sudo chmod a+r
sudo find /usr/local/include -type d | xargs sudo chmod a+rx
ls /usr/local/include/google/protobuf/
- name: Add ~/go/bin to PATH
run: |
echo "/home/runner/go/bin" >> $GITHUB_PATH
- name: Add /usr/local/bin to PATH
run: |
echo "/usr/local/bin" >> $GITHUB_PATH
- name: Create links
run: |
mkdir -p ~/go/src/github.com/argoproj
cp -a ../argo-rollouts ~/go/src/github.com/argoproj
- name: Vendor and Download
run: |
# We need to vendor go modules for codegen yet
go mod download
go mod vendor -v
go mod download
- name: Install UI code generator
run: |
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.25/swagger-codegen-cli-3.0.25.jar -O swagger-codegen-cli.jar
echo "#!/usr/bin/java -jar" > swagger-codegen
cat swagger-codegen-cli.jar >> swagger-codegen
chmod +x swagger-codegen
sudo mv swagger-codegen /usr/local/bin/swagger-codegen
rm swagger-codegen-cli.jar
- uses: actions/setup-java@v1
with:
java-version: "9.0.4"

- name: Run codegen
run: |
make codegen
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ site/
vendor/
# generated
docs/generated
# static
server/static/*
!server/static/.gitkeep
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
run:
deadline: 1m
skip-files:
- ".*\\.pb\\.go"
skip-dirs:
- pkg/client
modules-download-mode: readonly
Expand Down
42 changes: 39 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
####################################################################################################
FROM golang:1.15.8 as builder
FROM golang:1.16.1 as builder

RUN apt-get update && apt-get install -y \
wget \
Expand All @@ -24,21 +24,57 @@ RUN cd ${GOPATH}/src/dummy && \
golangci-lint run

####################################################################################################
# Rollout Controller Build stage which performs the actual build of argo-rollouts binaries
# UI build stage
####################################################################################################
FROM golang:1.15.8 as argo-rollouts-build
FROM docker.io/library/node:12.18.4 as argo-rollouts-ui

WORKDIR /src
ADD ["ui/package.json", "ui/yarn.lock", "./"]

RUN yarn install

ADD ["ui/", "."]

ARG ARGO_VERSION=latest
ENV ARGO_VERSION=$ARGO_VERSION
RUN NODE_ENV='production' yarn build

####################################################################################################
# Rollout Controller Build stage which performs the actual build of argo-rollouts binaries
####################################################################################################
FROM golang:1.16.1 as argo-rollouts-build

WORKDIR /go/src/github.com/argoproj/argo-rollouts

# Copy only go.mod and go.sum files. This way on subsequent docker builds if the
# dependencies didn't change it won't re-download the dependencies for nothing.
COPY go.mod go.sum ./
RUN go mod download

# Copy UI files for plugin build
COPY --from=argo-rollouts-ui ./src/dist/app ./ui/dist

# Perform the build
COPY . .

# stop make from trying to re-build this without yarn installed
RUN touch ui/dist/node_modules.marker
RUN mkdir ui/dist/app
RUN touch ui/dist/app/index.html

ARG MAKE_TARGET="controller plugin-linux plugin-darwin"
RUN make ${MAKE_TARGET}

####################################################################################################
# Kubectl plugin image
####################################################################################################
FROM scratch as kubectl-argo-rollouts

COPY --from=argo-rollouts-build /go/src/github.com/argoproj/argo-rollouts/dist/kubectl-argo-rollouts-linux-amd64 /bin/kubectl-argo-rollouts

WORKDIR /home/argo-rollouts

ENTRYPOINT ["/bin/kubectl-argo-rollouts", "dashboard"]

####################################################################################################
# Final image
Expand Down
Loading

0 comments on commit 7facfaa

Please sign in to comment.