Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

chore(base images): decouple build of base images to separate gh-action #464

Merged
merged 4 commits into from
Oct 5, 2021
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
46 changes: 46 additions & 0 deletions .github/workflows/build-sidecar-images-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# 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: Rebuild Sidecar Images / Push to Main

on:
push:
branches:
- main
paths:
- 'dockerfiles/**'

jobs:
rebuild-images-on-push:
runs-on: ubuntu-20.04
steps:
- name: Clone source code
uses: actions/checkout@v1
with:
fetch-depth: 0

- name: "Login to quay.io"
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Login to docker.io
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Rebuild sidecar images
run: ./build/workflows/build-sidecar-images-on-push.sh --push --rm --update-devfiles

- name: Bump devfiles to new sidecar tags
run: ./build/workflows/bump-devfiles-to-new-sidecar-tags.sh --pr
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,45 @@ jobs:
name: Validate digests for sidecar images
runs-on: ubuntu-20.04
steps:
-
name: "Checkout source code"
- name: "Checkout source code"
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: "Set up QEMU"

- name: "Set up QEMU"
uses: docker/setup-qemu-action@v1
-
name: "Set up Docker Buildx"

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1
-
name: "Docker quay.io Login"

- name: "Docker quay.io Login"
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: Login to docker.io

- name: Login to docker.io
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Login to registry.redhat.io

- name: Login to registry.redhat.io
uses: docker/login-action@v1
with:
registry: registry.redhat.io
username: ${{ secrets.CRW_BUILD_USER }}
password: ${{ secrets.CRW_BUILD_TOKEN }}
-
name: Login to registry.access.redhat.com

- name: Login to registry.access.redhat.com
uses: docker/login-action@v1
with:
registry: registry.access.redhat.com
username: ${{ secrets.CRW_BUILD_USER }}
password: ${{ secrets.CRW_BUILD_TOKEN }}

- name: Install skopeo
run: |
. /etc/os-release
Expand All @@ -66,10 +66,10 @@ jobs:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install skopeo
-
name: Run the digest checking script
- name: Run the digest checking script
run: |
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "mkuznets@redhat.com"
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }}
./arbitrary-users-patch/check_sidecar_image_digests.sh
./build/workflows/check-sidecar-image-digests.sh --pr
39 changes: 16 additions & 23 deletions .github/workflows/next-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ jobs:
next-build-publish:
runs-on: ubuntu-20.04
steps:
-
name: Clone source code
- name: Clone source code
uses: actions/checkout@v1
with:
fetch-depth: 0
-
name: Prepare

- name: Prepare
id: prep
run: |
set -e
Expand All @@ -36,48 +35,42 @@ jobs:
echo ::set-output name=image::${IMAGE}
PLATFORMS=$(cat PLATFORMS)
echo ::set-output name=platforms::${PLATFORMS}
-
name: "Set up QEMU"

- name: "Set up QEMU"
uses: docker/setup-qemu-action@v1
-
name: "Set up Docker Buildx"

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1
-
name: "Docker quay.io Login"

- name: "Login to quay.io"
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: Login to docker.io

- name: Login to docker.io
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push base images
run: ./arbitrary-users-patch/build_images.sh --push --rm
env:
TAG: next

- name: Build and push happy path image
run: ./arbitrary-users-patch/happy-path/build_happy_path_image.sh --push --rm
run: ./happy-path/build_happy_path_image.sh --push --rm
env:
TAG: next
-
name: "Build and push"

- name: "Build and push"
uses: docker/build-push-action@v2
with:
context: .
file: ./build/dockerfiles/Dockerfile
platforms: ${{ steps.package.outputs.content }}
tags: quay.io/eclipse/${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.version }},quay.io/eclipse/${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.short_sha1 }}
push: true

-
name: Set up yq

- name: Set up yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.7.0/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1

- name: Shellcheck
run: |
find . -type f -name '*.sh' | wc -l
Expand All @@ -29,52 +28,54 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1

- name: Run script which checks container image digest
run: |
sudo pip install yq
/bin/bash .ci/devfile-images-check.sh
build-dev-containers:
build-sidecar-images:
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
- name: Clone source code
uses: actions/checkout@v1
with:
fetch-depth: 0

- name: Build dev container images
run: ./arbitrary-users-patch/build_images.sh --rm
- name: Rebuild sidecar images
run: ./build/workflows/build-sidecar-images-on-push.sh --rm
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}

build-main-image:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1

-
name: Prepare
- name: Prepare
id: prep
run: |
PLATFORMS=$(cat PLATFORMS)
echo ::set-output name=platforms::${PLATFORMS}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Cache docker layers
uses: actions/cache@v1
with:
path: ./caches
key: v1-${{ github.head_ref }}

- name: Load docker layer cache
run: |
set +o pipefail
docker load -i ./caches/app.tar | true
- name: Build devfile registry
uses: docker/build-push-action@v2
with:
Expand All @@ -86,7 +87,7 @@ jobs:
cache-from: "type=local,src=/tmp/.buildx-cache"
cache-to: "type=local,dest=/tmp/.buildx-cache"
push: false

- name: Build offline devfile registry
uses: docker/build-push-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.Dockerfile
64 changes: 0 additions & 64 deletions arbitrary-users-patch/build_images.sh

This file was deleted.

Loading