ci: Add Next & SHA tagged container builds (#18)

* Add Next & SHA tagged container builds

Signed-off-by: Mykhailo Kuznietsov <mkuznets@redhat.com>

* fixup! Add Next & SHA tagged container builds

* fixup! fixup! Add Next & SHA tagged container builds

* Update .github/workflows/next-build.yml

Co-authored-by: Florent BENOIT <fbenoit@redhat.com>

Co-authored-by: Nick Boldt <nboldt@redhat.com>
Co-authored-by: Florent BENOIT <fbenoit@redhat.com>
pull/24/head
Mykhailo Kuznietsov 2021-06-07 19:34:09 +03:00 committed by GitHub
parent 30a8e4832e
commit 161264168e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 121 additions and 10 deletions

View File

@ -28,5 +28,5 @@ sed_in_place -r -e "s#che-keycloak:.*#che-keycloak:$image_version#g" ../deploy/k
sed_in_place -r -e "s#eclipse/che-server:.*#eclipse/che-server:$image_version#g" ../deploy/kubernetes/helm/che/values.yaml
sed_in_place -r -e "s#eclipse/che-dashboard:.*#eclipse/che-dashboard:$image_version#g" ../deploy/kubernetes/helm/che/values.yaml
sed_in_place -r -e "s#che-endpoint-watcher:nightly#che-endpoint-watcher:$image_version#g" ../deploy/kubernetes/helm/che/custom-charts/che-keycloak/templates/deployment.yaml
sed_in_place -r -e "s#che-endpoint-watcher:nightly#che-endpoint-watcher:$image_version#g" ../deploy/kubernetes/helm/che/templates/deployment.yaml
sed_in_place -r -e "s#che-endpoint-watcher:next#che-endpoint-watcher:$image_version#g" ../deploy/kubernetes/helm/che/custom-charts/che-keycloak/templates/deployment.yaml
sed_in_place -r -e "s#che-endpoint-watcher:next#che-endpoint-watcher:$image_version#g" ../deploy/kubernetes/helm/che/templates/deployment.yaml

91
.github/workflows/next-build.yml vendored Normal file
View File

@ -0,0 +1,91 @@
#
# Copyright (c) 2021 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
#
name: build-next
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11.0.11+9'
- name: Login to docker.io
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
registry: docker.io
- name: Login to quay.io
uses: docker/login-action@v1
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- name: Build with Maven
run: mvn -B clean install -U -Pintegration
- name: Build docker images
id: build
run:
SHORT_SHA1=$(git rev-parse --short HEAD)
echo ::set-output name=short_sha1::${SHORT_SHA1}
./dockerfiles/build.sh --tag:next --sha-tag
- name: Push docker images
run: |
docker push quay.io/eclipse/che-endpoint-watcher:next
docker push quay.io/eclipse/che-endpoint-watcher:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-keycloak:next
docker push quay.io/eclipse/che-keycloak:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-postgres:next
docker push quay.io/eclipse/che-postgres:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-dev:next
docker push quay.io/eclipse/che-dev:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-server:next
docker push quay.io/eclipse/che-server:${{ steps.build.outputs.short_sha1 }}
- name: Build ubi8 Che Server image
run:
./dockerfiles/che/build.sh --dockerfile:"rhel.Dockerfile" --tag:"rhel-next"
docker tag quay.io/eclipse/che-server:rhel-next quay.io/eclipse/che-server:rhel-${{ steps.build.outputs.short_sha1 }}
- name: Push ubi8 Che Server image
run:
docker push quay.io/eclipse/che-server:rhel-next
docker push quay.io/eclipse/che-server:rhel-${{ steps.build.outputs.short_sha1 }}
- name: Create failure MM message
if: ${{ failure() }}
run: |
echo "{\"text\":\":no_entry_sign: Next Che Server build has failed: https://github.com/eclipse-che/che-server/actions/workflows/next-build.yml\"}" > mattermost.json
- name: Send MM message
if: ${{ failure() }}
uses: mattermost/action-mattermost-notify@1.0.2
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: eclipse-che-ci
MATTERMOST_USERNAME: che-bot

View File

@ -48,25 +48,39 @@ jobs:
- name: Build with Maven
run: mvn -B clean install -U -Pintegration
- name: Build docker images
id: build
run:
./dockerfiles/build.sh
SHORT_SHA1=$(git rev-parse --short HEAD)
echo ::set-output name=short_sha1::${SHORT_SHA1}
./dockerfiles/build.sh --tag:nightly --sha-tag
- name: Push docker images
run: |
docker push quay.io/eclipse/che-endpoint-watcher:nightly
docker push quay.io/eclipse/che-endpoint-watcher:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-keycloak:nightly
docker push quay.io/eclipse/che-keycloak:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-postgres:nightly
docker push quay.io/eclipse/che-postgres:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-dev:nightly
docker push quay.io/eclipse/che-dev:${{ steps.build.outputs.short_sha1 }}
docker push quay.io/eclipse/che-server:nightly
docker push quay.io/eclipse/che-server:${{ steps.build.outputs.short_sha1 }}
- name: Build ubi8 Che Server image
run:
./dockerfiles/che/build.sh --dockerfile:"rhel.Dockerfile" --tag:"rhel-nightly"
docker tag quay.io/eclipse/che-server:rhel-nightly quay.io/eclipse/che-server:rhel-${{ steps.build.outputs.short_sha1 }}
- name: Push ubi8 Che Server image
run:
docker push quay.io/eclipse/che-server:rhel-nightly
docker push quay.io/eclipse/che-server:rhel-${{ steps.build.outputs.short_sha1 }}
- name: Create failure MM message
if: ${{ failure() }}
run: |
echo "{\"text\":\":no_entry_sign: Nightly Che Server build has failed: https://github.com/eclipse/che/actions/workflows/nightly-build.yml\"}" > mattermost.json
echo "{\"text\":\":no_entry_sign: Nightly Che Server build has failed: https://github.com/eclipse-che/che-server/actions/workflows/nightly-build.yml\"}" > mattermost.json
- name: Send MM message
if: ${{ failure() }}
uses: mattermost/action-mattermost-notify@1.0.2

View File

@ -12,7 +12,7 @@ global:
class: "nginx"
cheDevfileRegistry:
image: quay.io/eclipse/che-devfile-registry:nightly
image: quay.io/eclipse/che-devfile-registry:next
imagePullPolicy: Always
memoryLimit: 256Mi
memoryRequests: 16Mi

View File

@ -12,7 +12,7 @@ global:
class: "nginx"
chePluginRegistry:
image: quay.io/eclipse/che-plugin-registry:nightly
image: quay.io/eclipse/che-plugin-registry:next
imagePullPolicy: Always
memoryLimit: 256Mi
memoryRequests: 16Mi

View File

@ -10,4 +10,4 @@
# Default values for postgres.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image: quay.io/eclipse/che-postgres:nightly
image: quay.io/eclipse/che-postgres:next

View File

@ -21,7 +21,7 @@ cheWorkspaceNoProxy: ""
# operator: "Equal"
# value: "aValue"
# effect: "NoExecute"
cheImage: quay.io/eclipse/che-server:nightly
cheImage: quay.io/eclipse/che-server:next
cheImagePullPolicy: Always
cheKeycloakRealm: "che"
cheKeycloakClientId: "che-public"
@ -51,7 +51,7 @@ global:
cheHost: ""
# Image used by endpoint watchers
endpointWatcher:
image: quay.io/eclipse/che-endpoint-watcher:nightly
image: quay.io/eclipse/che-endpoint-watcher:next
# Use internal cluster svc names to communicate between components
useInternalClusterSVCNames: true

View File

@ -41,7 +41,7 @@ init() {
ORGANIZATION="quay.io/eclipse"
PREFIX="che"
TAG="nightly"
TAG="next"
SKIP_TESTS=false
NAME="che"
ARGS=""
@ -75,6 +75,9 @@ init() {
--skip-tests)
SKIP_TESTS=true
shift ;;
--sha-tag)
SHA_TAG=$(git rev-parse --short HEAD)
shift ;;
--dockerfile:*)
DOCKERFILE="${1#*:}"
shift ;;
@ -142,6 +145,9 @@ build_image() {
for TMP_IMAGE_NAME in ${IMAGE_ALIASES}
do
docker tag ${IMAGE_NAME} ${TMP_IMAGE_NAME}:${TAG}
if [ -n "${SHA_TAG}" ]; then
docker tag ${IMAGE_NAME} ${TMP_IMAGE_NAME}:${SHA_TAG}
fi
DOCKER_TAG_STATUS=$?
if [ $DOCKER_TAG_STATUS -eq 0 ]; then
printf " /alias ${BLUE}${TMP_IMAGE_NAME}:${TAG}${NC} ${GREEN}[OK]${NC}\n"