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

chore: add release scripts so configbump can follow che releases (and stay current w/ CVE fixes) #98

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 0 additions & 140 deletions .github/workflows/build.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/make-branch.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/next-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Copyright (c) 2023 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

name: Configbump Next Build

on:
workflow_dispatch:
inputs:
push:
branches: [ main ]
jobs:
build-push:
runs-on: ubuntu-22.04
steps:
- name: Checkout configmump source code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to quay.io
uses: docker/login-action@v2
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- id: vars
shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push both short SHA tag and next tag
uses: docker/build-push-action@v3
with:
file: build/dockerfiles/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
quay.io/che-incubator/configbump:next
quay.io/che-incubator/configbump:${{ steps.vars.outputs.sha_short }}
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#
# Copyright (c) 2023 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

name: Release Che Configbump

on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
description: 'The version that is going to be released. Should be in format 7.y.z'
required: true
noCommit:
description: 'If true, will not commit the version bump changes'
default: ''
forceRecreateTags:
description: If true, tags will be recreated. Use with caution
required: false
default: 'false'
jobs:
build:
name: Create Release
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check existing tags
run: |
set +e
RECREATE_TAGS=${{ github.event.inputs.forceRecreateTags }}
VERSION=${{ github.event.inputs.version }}
EXISTING_TAG=$(git ls-remote --exit-code origin refs/tags/${VERSION})
if [[ -n ${EXISTING_TAG} ]]; then
if [[ ${RECREATE_TAGS} == "true" ]]; then
echo "[INFO] Removing tag for ${VERSION} version. New tag will be recreated during release."
git push origin :$VERSION
else
echo "[ERROR] Cannot proceed with release - tag ${EXISTING_TAG} already exists."
exit 1
fi
else
echo "[INFO] No existing tags detected for $VERSION"
fi
- name: Login to quay.io
uses: docker/login-action@v2
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Create Release
run: |
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "mkuznets@redhat.com"
git config --global pull.rebase true
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }}
NO_COMMIT=${{ github.event.inputs.noCommit}}
if [[ $NO_COMMIT == "true" ]]; then
NO_COMMIT="--no-commit"
else
NO_COMMIT=
fi
/bin/bash make-release.sh --version ${{ github.event.inputs.version }} --trigger-release $NO_COMMIT
# - name: Create failure MM message
# if: ${{ failure() }}
# run: |
# echo "{\"text\":\":no_entry_sign: Che Configbump ${{ github.event.inputs.version }} release has failed: https://github.com/che-incubator/configbump/actions/workflows/release.yml\"}" > mattermost.json
# - name: Create success MM message
# run: |
# echo "{\"text\":\":white_check_mark: Che Configbump ${{ github.event.inputs.version }} has been released: quay.io/che-incubator/configbump:${{ github.event.inputs.version }}\"}" > mattermost.json
# - name: Send MM message
# if: ${{ success() }} || ${{ failure() }}
# uses: mattermost/action-mattermost-notify@1.1.0
# env:
# MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
# MATTERMOST_CHANNEL: eclipse-che-releases
# MATTERMOST_USERNAME: che-bot
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ We originally wrote a prototype of this tool in Rust (https://github.com/metlos/

```
$ ./configbump --help
config-bump 0.1.0
config-bump 7.75.0-SNAPSHOT
Usage: configbump --dir DIR --labels LABELS [--namespace NAMESPACE]

Options:
Expand Down
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Eclipse Che Configbump release process

Use "Release Che Configbump" workflow for release, which can be triggered manually on GitHub page of the repository at Actions -> "Release Che Configbump" -> "Run workflow"
nickboldt marked this conversation as resolved.
Show resolved Hide resolved

Normally this workflow will be triggered as part of a Che release - see https://github.com/eclipse-che/che-release/actions/workflows/release-orchestrate-overall.yml
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.75.0-SNAPSHOT
7 changes: 7 additions & 0 deletions build/dockerfiles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Dockerfile Clarification

**Dockerfile** is the Eclipse Che build file, used in this repo to publish to [quay.io/che-incubator/configbump](https://quay.io/repository/che-incubator/configbump?tab=tags).

**rhel.Dockerfile** is the build file for the [Red Hat OpenShift Devspaces](https://github.com/redhat-developer/devspaces-images/tree/devspaces-3-rhel-8/devspaces-configbump) image, which can be run locally.

**brew.Dockerfile** is a variation on `rhel.Dockerfile` specifically for Red Hat builds, and cannot be run locally as is.
2 changes: 1 addition & 1 deletion cmd/configbump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type opts struct {

// Version returns the version of the program
func (opts) Version() string {
return "config-bump 0.1.0"
return "config-bump 7.75.0-SNAPSHOT"
}

const controllerName = "config-bump"
Expand Down
Loading