Skip to content

Commit

Permalink
chore: automate release process
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Suen <[email protected]>
  • Loading branch information
jessesuen committed Apr 29, 2021
1 parent 304cb39 commit 26c1522
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 133 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.DS_Store
dist/
ui/dist/
*.iml
# delve debug binaries
cmd/**/debug
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- master
- release-*
tags:
- v*.*.*

# Run tests for any PRs.
pull_request:
Expand Down Expand Up @@ -58,7 +56,6 @@ jobs:
ghcr.io/argoproj/argo-rollouts
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Docker meta (plugin)
id: plugin-meta
Expand All @@ -69,7 +66,6 @@ jobs:
ghcr.io/argoproj/kubectl-argo-rollouts
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
# avoid building linux/arm64 for PRs since it takes so long
- name: Set Platform Matrix
Expand All @@ -81,16 +77,16 @@ jobs:
fi
echo "::set-output name=platform-matrix::$PLATFORM_MATRIX"
- name: Build and push (controller)
- name: Build and push (controller-image)
uses: docker/build-push-action@v2
with:
platforms: ${{ steps.platform-matrix.outputs.platform-matrix }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.controller-meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build and push (plugin)
- name: Build and push (plugin-image)
uses: docker/build-push-action@v2
with:
target: kubectl-argo-rollouts
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Release

on:
workflow_dispatch:
inputs:
tag:
description: Git tag to build release from
required: true

jobs:
release-images:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Print Disk Usage
run: |
df -ah
docker buildx du
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Login to Quay.io
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v1
# with:
# registry: quay.io
# username: ${{ secrets.QUAY_USERNAME }}
# password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: Docker meta (controller)
id: controller-meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: |
quay.io/argoproj/argo-rollouts
ghcr.io/argoproj/argo-rollouts
tags: |
type=semver,pattern={{version}}
- name: Docker meta (plugin)
id: plugin-meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: |
quay.io/argoproj/kubectl-argo-rollouts
ghcr.io/argoproj/kubectl-argo-rollouts
tags: |
type=semver,pattern={{version}}
- name: Build and push (controller-image)
uses: docker/build-push-action@v2
with:
#platforms: linux/amd64,linux/arm64
platforms: linux/amd64
#push: true
push: false
tags: ${{ steps.controller-meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build and push (plugin-image)
uses: docker/build-push-action@v2
with:
target: kubectl-argo-rollouts
#platforms: linux/amd64,linux/arm64
platforms: linux/amd64
#push: true
push: false
tags: ${{ steps.plugin-meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
release-artifacts:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}

- name: Generate release artifacts
run: |
make release-plugins
make manifests IMAGE_TAG=${{ github.event.inputs.tag }}
- name: Draft release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag }}
draft: true
files: |
dist/kubectl-argo-rollouts-linux-amd64
dist/kubectl-argo-rollouts-darwin-amd64
manifests/install.yaml
manifests/namespace-install.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 81 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,86 @@
# Changelog

# v1.0.0

## Notable Features
* New Argo Rollouts UI available in `kubectl argo rollouts dashboard`
* Ability to reference existing Deployment workloads instead of inlining a PodTemplate at spec.template
* Support for Ambassador as a canary traffic router
* Support canarying using Istio DestinationRule subsets

## Upgrade Notes

### Installation Manifests

Installation manifests are now attached as GitHub Release artifacts (as opposed to raw files checked into git)
and can be installed with the release download URL. e.g.:

```
kubectl apply -f https://github.com/argoproj/argo-rollouts/releases/download/v1.0.0/install.yaml
```

### Argo CD OutOfSync status on Rollout v1.0.0 CRDs:

Argo Rollouts v1.0 now vends apiextensions.k8s.io/v1 CustomResourceDefinitions (previously apiextensions.k8s.io/v1beta1).
Kubernetes v1 CRDs no longer supports the preservation of unknown fields in objects, and rejects
attempts to set `spec.preserveUnknownFields: true`. In order to support a smooth upgrade from
Argo Rollouts v0.10 to v1.0, `spec.preserveUnknownFields` is explicitly set to `false` in the manifests,
despite `false` being the default, and only option in v1 CRDs. However this causes diffing tools
(such as Argo CD) to report the manifest as OutOfSync (since K8s drops the false field).

More information:
* https://github.com/kubernetes-sigs/controller-tools/issues/476
* https://github.com/argoproj/argo-rollouts/pull/1069

To avoid the Argo CD OutOfSync conditions, you can remove `spec.preserveUnknownFields` from the manifests
entirely *after upgrading from v0.10*.

## Changes since v0.10

### Controller
* feat: support reference model for workloads (#676) (#1072)
* feat: Implement Ambassador to be used as traffic router for canary deployments (#1025)
* feat: support canarying using Istio DestinationRule subsets (#985)
* feat: istio virtualservice and rollout in different namespaces
* feat: add ability to verify canary weights before advancing steps (#957)
* feat: support scaleDownDelaySeconds in canary w/ traffic routing (#1056)
* feat: Add ability to restart maxUnavailable pods to BlueGreen strategy (#937)
* feat(controller): Add support for ephemeral metadata on BlueGreen rollouts. Fixes #973 (#974)
* feat: Allow user to handle NaN result in Analysis (#977)
* feat: Wait for canary RS to have ready replicas before shifting labels (#1022)
* feat: Create RolloutPaused condition (#1054)
* feat: Add RolloutCompleted condition (#1074)
* fix: Fixes the regression of dropping resources from argo-rollouts crds. Fixes #1043 (#1044)
* fix: Set Canary Strategy default maxUnavailable to 25% (#981)
* fix: blue-green rollouts could pause prematurely during prePromotionAnalysis (#1007)
* fix: Clear ProgressDeadlineExceeded Condition in paused BlueGreen Rollout (#1002)
* fix: analysis template arguments validate (#1038)
* fix: calculate scale down count. (#1047)
* fix: verify analysis arguments name with those in the rollout (#1071)
* fix: rollout status always in progressing if analysis fails (#1099)

### Analysis
* feat: metric fields can be parameterized by analysis arguments (#901)
* feat: support a custom base URL for the new relic provider (#1053)
* feat: Allow Datadog API and APP keys to be consumed from env vars (#1073)
* fix: Improve validation for AnalysisTemplates referenced by RO (#1094)
* fix: wavefront queries would return no datapoints. surface evaluate errors
* fix: metrics which errored did not retry at error interval

### Plugin
* feat: Argo Rollouts api-server and UI (#1015)
* feat: Implement rollout status command. Fixes #596 (#1001)
* fix: get rollout always return not found except default namespace (#961)
* fix: create command not support namespace in yaml file (#962)
* fix: kubectl argo create panic: runtime error: invalid memory address or nil pointer dereference

### Misc
* chore: publish plugin image automatically. migrate to quay.io (#1102)
* feat: support ARM builds, remove unused components in Dockerfile (#889)
* chore: update k8s dependencies to v1.20. improve logging (#994)
* fix: add informational exposed ports to deployment (#1066)


# v0.10.2

## Changes since v0.10.1
Expand Down
13 changes: 7 additions & 6 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.16.1 as builder
FROM golang:1.16.3 as builder

RUN apt-get update && apt-get install -y \
wget \
Expand Down Expand Up @@ -42,7 +42,7 @@ 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
FROM golang:1.16.3 as argo-rollouts-build

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

Expand All @@ -52,15 +52,16 @@ 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
COPY --from=argo-rollouts-ui /src/dist/app ./ui/dist/app

# Perform the build
COPY . .

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

ARG MAKE_TARGET="controller plugin-linux plugin-darwin"
RUN make ${MAKE_TARGET}
Expand Down
21 changes: 7 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ PATH := $(DIST_DIR):$(PATH)
PLUGIN_CLI_NAME?=kubectl-argo-rollouts
TEST_TARGET ?= ./...

VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
GIT_REMOTE_REPO=upstream
VERSION=$(shell if [ ! -z "${GIT_TAG}" ] ; then echo "${GIT_TAG}" | sed -e "s/^v//" ; else cat VERSION ; fi)

# docker image publishing options
DOCKER_PUSH=false
IMAGE_TAG=latest
# build development images
DEV_IMAGE=false

Expand All @@ -25,18 +29,9 @@ override LDFLAGS += \
-X ${PACKAGE}/utils/version.gitCommit=${GIT_COMMIT} \
-X ${PACKAGE}/utils/version.gitTreeState=${GIT_TREE_STATE}

# docker image publishing options
DOCKER_PUSH=false
IMAGE_TAG=latest
ifneq (${GIT_TAG},)
IMAGE_TAG=${GIT_TAG}
LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
endif
ifneq (${IMAGE_NAMESPACE},)
override LDFLAGS += -X ${PACKAGE}/install.imageNamespace=${IMAGE_NAMESPACE}
endif
ifneq (${IMAGE_TAG},)
override LDFLAGS += -X ${PACKAGE}/install.imageTag=${IMAGE_TAG}
override LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
endif

ifeq (${DOCKER_PUSH},true)
Expand Down Expand Up @@ -185,21 +180,19 @@ controller:

.PHONY: plugin
plugin: ui/dist
cp -r ui/dist/app/* server/static
CGO_ENABLED=0 go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME} ./cmd/kubectl-argo-rollouts

ui/dist:
yarn --cwd ui install
yarn --cwd ui build
cp -r ui/dist/app/* server/static

.PHONY: plugin-linux
plugin-linux: ui/dist
cp -r ui/dist/app server/static
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-linux-amd64 ./cmd/kubectl-argo-rollouts

.PHONY: plugin-darwin
plugin-darwin: ui/dist
cp -r ui/dist/app server/static
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -v -i -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-darwin-amd64 ./cmd/kubectl-argo-rollouts

.PHONY: plugin-docs
Expand Down
Loading

0 comments on commit 26c1522

Please sign in to comment.