Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve robustness of releases. Fixes #3004 #3009

Merged
merged 24 commits into from
May 13, 2020
Merged
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ jobs:
- yarn-packages-v3-{{ checksum "ui/yarn.lock" }}
- run:
name: Download dependencies
command: yarn --cwd ui install --frozen-lockfile --ignore-optional --non-interactive
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we make these the default options in the .yarnrc

command: yarn --cwd ui install
# - run: yarn test
- run: yarn --cwd ui build
- run: yarn --cwd ui lint
Expand Down
24 changes: 15 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ FROM node:14.0.0 as argo-ui

ADD ["ui", "."]

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

####################################################################################################
Expand All @@ -91,20 +91,26 @@ WORKDIR /go/src/github.com/argoproj/argo
COPY . .
# check we can use Git
RUN git rev-parse HEAD
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/node_modules.marker
RUN touch ui/dist/app/index.html
# fail the build if we are "dirty"
# fail the build if we are "dirty" prior to build
RUN git diff --exit-code
RUN make argo-server.crt argo-server.key
RUN if [ "${IMAGE_OS}" = "linux" -a "${IMAGE_ARCH}" = "amd64" ]; then \
make dist/argo-linux-amd64 dist/workflow-controller-linux-amd64 dist/argoexec-linux-amd64; \
elif [ "${IMAGE_OS}" = "linux" -a "${IMAGE_ARCH}" = "arm64" ]; then \
make dist/argo-linux-arm64 dist/workflow-controller-linux-arm64 dist/argoexec-linux-arm64; \
fi
# order is important, must build the CLI first, as building can make the build dirty
RUN make \
argo-server.crt \
argo-server.key \
dist/argo-linux-${IMAGE_ARCH} \
dist/workflow-controller-linux-${IMAGE_ARCH} \
dist/argoexec-linux-${IMAGE_ARCH}
# double check "dirty"
RUN git diff --exit-code
# triple check "dirty"
RUN ["sh", "-c", "./dist/workflow-controller-linux-${IMAGE_ARCH} version | grep clean"]
# we can't check the argo cli, it must have a Kubernetes cluster to work
RUN ["sh", "-c", "./dist/argoexec-linux-${IMAGE_ARCH} version | grep clean"]

####################################################################################################
# argoexec
Expand Down
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ VERSION := latest
endif

ifneq ($(findstring release,$(GIT_BRANCH)),)
# this will be something like "v2.5" or "v3.7"
MAJOR_MINOR := v$(word 2,$(subst -, ,$(GIT_BRANCH)))
# if GIT_TAG is on HEAD, then this will be the same
GIT_LATEST_TAG := $(shell git tag --merged | tail -n1)
# only use the latest tag if it matches the correct major/minor version
ifneq ($(findstring $(MAJOR_MINOR),$(GIT_LATEST_TAG)),)
VERSION := $(GIT_LATEST_TAG)
endif
VERSION := $(shell git tag --points-at=HEAD|grep ^v|head -n1)
endif

# MANIFESTS_VERSION is the version to be used for files in manifests and should always be latests unles we are releasing
Expand Down Expand Up @@ -78,7 +71,7 @@ CONTROLLER_IMAGE_FILE := dist/controller-image.$(VERSION)
STATIC_BUILD ?= true
CI ?= false
DB ?= postgres
K3D := $(shell if [ "`kubectl config current-context`" = "k3s-default" ]; then echo true; else echo false; fi)
K3D := $(shell if [ `which kubectl` <> '' ] && [ "`kubectl config current-context`" = "k3s-default" ]; then echo true; else echo false; fi)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removes annoying kubectl not found warning

# which components to start, useful if you want to disable them to debug
COMPONENTS := controller,argo-server
LOG_LEVEL := debug
Expand Down Expand Up @@ -127,7 +120,7 @@ endef
define docker_build
# If we're making a dev build, we build this locally (this will be faster due to existing Go build caches).
if [ $(DEV_IMAGE) = true ]; then $(MAKE) dist/$(2)-$(OUTPUT_IMAGE_OS)-$(OUTPUT_IMAGE_ARCH) && mv dist/$(2)-$(OUTPUT_IMAGE_OS)-$(OUTPUT_IMAGE_ARCH) $(2); fi
docker build $(DOCKER_BUILD_OPTS) -t $(IMAGE_NAMESPACE)/$(1):$(VERSION) --target $(1) -f $(DOCKERFILE) --build-arg IMAGE_OS=$(OUTPUT_IMAGE_OS) --build-arg IMAGE_ARCH=$(OUTPUT_IMAGE_ARCH) .
docker build --progress plain $(DOCKER_BUILD_OPTS) -t $(IMAGE_NAMESPACE)/$(1):$(VERSION) --target $(1) -f $(DOCKERFILE) --build-arg IMAGE_OS=$(OUTPUT_IMAGE_OS) --build-arg IMAGE_ARCH=$(OUTPUT_IMAGE_ARCH) .
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"plain" shows more info and made issues easier to diagnose

if [ $(DEV_IMAGE) = true ]; then mv $(2) dist/$(2)-$(OUTPUT_IMAGE_OS)-$(OUTPUT_IMAGE_ARCH); fi
if [ $(K3D) = true ]; then k3d import-images $(IMAGE_NAMESPACE)/$(1):$(VERSION); fi
touch $(3)
Expand All @@ -152,7 +145,7 @@ ui/dist/node_modules.marker: ui/package.json ui/yarn.lock
# Get UI dependencies
@mkdir -p ui/node_modules
ifeq ($(CI),false)
yarn --cwd ui install --frozen-lockfile --ignore-optional --non-interactive
yarn --cwd ui install
endif
@mkdir -p ui/dist
touch ui/dist/node_modules.marker
Expand All @@ -167,8 +160,9 @@ else
endif

$(GOPATH)/bin/staticfiles:
# Install the "staticfiles" tool
$(call backup_go_mod)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what was making builds "dirty"

go get bou.ke/staticfiles
$(call restore_go_mod)

server/static/files.go: $(GOPATH)/bin/staticfiles ui/dist/app/index.html
# Pack UI into a Go file.
Expand Down
42 changes: 41 additions & 1 deletion docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,27 @@ To generate new manifests and perform basic checks:

Publish the images and local Git changes (disabling K3D as this is faster and more reliable for releases):

make publish-release K3D=false
make publish-release K3D=false VERSION=v2.7.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check the version here


* [ ] Check the images were pushed successfully.

```
docker pull argoproj/workflow-controller:v2.7.2
docker pull argoproj/argoexec:v2.7.2
docker pull argoproj/argocli:v2.7.2
```

* [ ] Check the correct versions are printed:

```
docker run argoproj/workflow-controller:v2.7.2 version
docker run argoproj/argoexec:v2.7.2 version
docker run argoproj/argocli:v2.7.2 version
```

* [ ] Check the manifests contain the correct tags: https://raw.githubusercontent.com/argoproj/argo/v2.7.2/manifests/install.yaml

### Release Notes

Create [the release](https://github.com/argoproj/argo/releases) in Github. You can get some text for this using [Github Toolkit](https://github.com/alexec/github-toolkit):

Expand All @@ -27,8 +47,28 @@ Release notes checklist:
* [ ] All breaking changes are listed with migration steps
* [ ] The release notes identify every publicly known vulnerability with a CVE assignment

### Update Stable Tag

If this is GA:

* [ ] Update the `stable` tag

```
git tag -f stable
git push -f origin stable
```

* [ ] Check the manifests contain the correct tags: https://raw.githubusercontent.com/argoproj/argo/stable/manifests/install.yaml

### Update Homebrew

If this is GA:

* [ ] Update the [Homebrew tap](https://github.com/argoproj/homebrew-tap).
* [ ] Check Homebrew was successfully updated:

```
brew upgrade argoproj/tap/argo
argo version
```

2 changes: 2 additions & 0 deletions ui/.yarnrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
--add.ignore-optional true
--install.ignore-optional true
--install.frozen-lockfile true
--install.non-interactive true