diff --git a/hack/create-release-pr.sh b/hack/create-release-pr.sh index 4bb65f17..faf756b0 100755 --- a/hack/create-release-pr.sh +++ b/hack/create-release-pr.sh @@ -46,14 +46,6 @@ make manifests # Create PR for the release git checkout -b "feat/new-version-${NEW_VERSION}" -# Create tag for registry-scanner -git tag -a ${IMAGE_TAG} -m "Registry-Scanner Release ${IMAGE_TAG}" -git push ${REMOTE} "v${NEW_VERSION}" - -# Update registry-scanner version in go.mod -go mod edit -require github.com/argoproj-labs/argocd-image-updater/registry-scanner@${IMAGE_TAG} -go mod download && go mod tidy - # Commit and push the changes git commit -m "Release ${NEW_VERSION}" VERSION go.mod go.sum manifests/ git push --set-upstream ${REMOTE} "feat/new-version-${NEW_VERSION}" diff --git a/registry-scanner/VERSION b/registry-scanner/VERSION new file mode 100644 index 00000000..5af665a1 --- /dev/null +++ b/registry-scanner/VERSION @@ -0,0 +1 @@ +0.111.0 diff --git a/registry-scanner/docs/contributing/development.md b/registry-scanner/docs/contributing/development.md new file mode 100644 index 00000000..0e0d05e0 --- /dev/null +++ b/registry-scanner/docs/contributing/development.md @@ -0,0 +1,39 @@ +# Developing + +## Requirements + +Getting started to develop Registry Scanner shouldn't be too hard. All that +is required is a simple build toolchain, consisting of: + +* Golang +* GNU make +* Docker (for building images, optional) +* Kustomize (for building K8s manifests, optional) + +## Makefile targets + +Most steps in the development process are scripted in the `Makefile`, the most +important targets are: + +* `all` - this is the default target, and will run `golangci-lint` to ensure code is linted correctly and run all the unit tests. + +* `lint` - this will run `golangci-lint` and ensure code is linted correctly. + +* `test` - this will run all the unit tests + + +## Sending Pull Requests + +To send a pull request, simply fork the +[GitHub repository](https://github.com/argoproj-labs/argocd-image-updater) +to your GitHub account, create a new branch, commit & push your changes and then +send the PR over for review. Changes should be +[signed off](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--s) +and committed with `-s` or `--signoff` options to meet +[Developer Certificate of Origin](https://probot.github.io/apps/dco/) requirement. + +When developing new features or fixing bugs, please make sure that your code is +accompanied by appropriate unit tests. If you are fixing a bug, please also +include a unit test for that specific bug. + +Also, please make sure that your code is correctly linted. diff --git a/registry-scanner/docs/contributing/releasing.md b/registry-scanner/docs/contributing/releasing.md new file mode 100644 index 00000000..124e7f0d --- /dev/null +++ b/registry-scanner/docs/contributing/releasing.md @@ -0,0 +1,54 @@ +# Releasing + +Registry Scanner is released in a 1 step automated fashion. The release process takes about 5 minutes. + +Releases can only be done by people that have write/commit access on the Argo Image Updater GitHub repository. + +## Introduction + +First install on your workstation the following: + +1. GoLang +1. The `git` executable +1. The [GitHub CLI](https://cli.github.com/) +1. The `semver` cli with `go install github.com/davidrjonas/semver-cli@latest` + +Then create a release branch and cd to the submodule: + +```bash +git clone git@github.com:argoproj-labs/argocd-image-updater.git +git checkout -b registry-scanner/release-0.13 +git push origin registry-scanner/release-0.13 +``` + +The release name is just an example. You should use the next number from the [previous release](https://github.com/argoproj-labs/argocd-image-updater/releases). Make sure that the branch is named as `registry-scanner/release-X.XX` though. + +!!!Note: +`TARGET_VERSION` is the version we want to release for registry-scanner module. + +Also note that `origin` is just an example. It should be the name of your remote that holds the upstream branch of Argo Image updater repository. + +Finally run + +```bash +cd registry-scanner +./hack/create-release-pr.sh ${TARGET_VERSION} ${REMOTE} +``` + +e.g.: +```bash +cd registry-scanner +./hack/create-release-pr.sh 0.1.0 origin +``` + +You are finished! + + + + + + + + + + diff --git a/registry-scanner/docs/contributing/start.md b/registry-scanner/docs/contributing/start.md new file mode 100644 index 00000000..957e7b0d --- /dev/null +++ b/registry-scanner/docs/contributing/start.md @@ -0,0 +1,14 @@ +# Contributing to Registry Scanner + +Contributing to Registry Scanner is easy! You can contribute in a number of +ways, e.g. + +* raise bug reports in the issue tracker, +* send your ideas for enhancing Registry Scanner, +* participate with your knowledge in existing issues, +* vote for existing feature requests, +* send Pull Requests for the docs, for the code, for the build toolchain, etc + +Everyone is welcome to contribute! + +If you just want to show some appreciation, make sure to star our GitHub repo. \ No newline at end of file diff --git a/registry-scanner/hack/create-release-pr.sh b/registry-scanner/hack/create-release-pr.sh new file mode 100755 index 00000000..0928cc1e --- /dev/null +++ b/registry-scanner/hack/create-release-pr.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +### This script creates a new release PR +# - install gh cli and semver-cli (go install github.com/davidrjonas/semver-cli@latest) +# - create and push "release-X.Y" branch +# - checkout this branch locally +# - run this script from repo root: ./hack/create-release-pr.sh [REMOTE] +# - merge the PR +# It will trigger the release workflow that would create release draft on github + +TARGET_VERSION="$1" +set -eu +set -o pipefail + +if test "${TARGET_VERSION}" = ""; then + echo "USAGE: $0 " >&2 + exit 1 +fi + +CURRENT_BRANCH="$(git branch --show-current)" +SUBMODULE_NAME="registry-scanner" + +if [[ ! "$CURRENT_BRANCH" == release-* ]]; then + echo "!! Please checkout branch 'release-X.Y' (currently in branch: '${CURRENT_BRANCH}')" >&2 + exit 1 +fi + +RELEASE_BRANCH="${CURRENT_BRANCH}" + +REMOTE=${2:-origin} +REMOTE_URL=$(git remote get-url "${REMOTE}") + +if [[ ! $(git ls-remote --exit-code ${REMOTE_URL} ${RELEASE_BRANCH}) ]]; then + echo "!! Please make sure '${RELEASE_BRANCH}' exists in remote '${REMOTE}'" >&2 + exit 1 +fi + +NEW_TAG="registry-scanner/v${TARGET_VERSION}" + +### look for latest on-branch tag to check if it matches the NEW_TAG +PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "${SUBMODULE_NAME}/*" 2>/dev/null || true) + +if [ "${PREVIOUS_TAG}" == "${NEW_TAG}" ]; then + echo "!! Tag ${NEW_TAG} already exists" >&2 + exit 1 +fi + +echo "Creating tag ${NEW_TAG}" +echo "${TARGET_VERSION}" > VERSION + +# Create tag for registry-scanner +git tag "${NEW_TAG}" +git push "${REMOTE}" tag "${NEW_TAG}" +