Skip to content

Commit

Permalink
Separate releasing registry-scanner from image-updater
Browse files Browse the repository at this point in the history
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
  • Loading branch information
ishitasequeira committed Jan 30, 2025
1 parent 41ee130 commit 671ea1f
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 8 deletions.
8 changes: 0 additions & 8 deletions hack/create-release-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
1 change: 1 addition & 0 deletions registry-scanner/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.111.0
39 changes: 39 additions & 0 deletions registry-scanner/docs/contributing/development.md
Original file line number Diff line number Diff line change
@@ -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.
54 changes: 54 additions & 0 deletions registry-scanner/docs/contributing/releasing.md
Original file line number Diff line number Diff line change
@@ -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!










14 changes: 14 additions & 0 deletions registry-scanner/docs/contributing/start.md
Original file line number Diff line number Diff line change
@@ -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.
54 changes: 54 additions & 0 deletions registry-scanner/hack/create-release-pr.sh
Original file line number Diff line number Diff line change
@@ -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 <version>" >&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}"

0 comments on commit 671ea1f

Please sign in to comment.