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

👻 Add newfile.txt #20

Closed
wants to merge 3 commits into from
Closed
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
105 changes: 105 additions & 0 deletions .github/workflows/ci-image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI (test image build for a PR with build related changes)

on:
pull_request:
branches:
- "main"
- "release-*"

jobs:
checks:
runs-on: ubuntu-latest
outputs:
should-test: ${{ steps.check-changes.outputs.should-test }}

steps:
- uses: actions/checkout@v4

- name: What files changed?
id: changed
uses: tj-actions/changed-files@v44
with:
files: |
Dockerfile
package-lock.json

- name: Check if build related files have been changed in a PR
id: check-changes
env:
IS_PR: ${{ !!github.event.pull_request }}
ANY_MODIFIED: ${{ steps.changed.outputs.any_modified }}
run: |
TEST_IMAGE_BUILD=$(
if [[ $IS_PR == true ]] && [[ $ANY_MODIFIED == true ]]; then
echo "true"
else
echo "false"
fi
)

echo "is-pr=$IS_PR" >> "$GITHUB_OUTPUT"
echo "changed=${ANY_MODIFIED:-false}" >> "$GITHUB_OUTPUT"
echo "should-test=$TEST_IMAGE_BUILD" >> "$GITHUB_OUTPUT"

- name: Summarize findings
env:
MODIFIED_FILES: ${{ steps.changed.outputs.all_modified_files }}
run: |
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
## Findings
PR triggered? \`${{ steps.check-changes.outputs.is-pr }}\`
PR includes a build file related change? \`${{ steps.check-changes.outputs.changed }}\`
Should the image build be tested? \`${{ steps.check-changes.outputs.should-test }}\`
EOF

if [[ "${MODIFIED_FILES}" -ne "" ]]; then
echo "## Build related modified files" >> "$GITHUB_STEP_SUMMARY"
for file in ${MODIFIED_FILES}; do
echo " - \`$file\`" >> "$GITHUB_STEP_SUMMARY"
done
fi

#
# Based on:
# - image-build.yaml
# - konveyor/release-tools/.github/workflows/build-push-images.yaml@main
#
# Only test the image build, no push to quay is required.
#
test-image-build:
runs-on: ubuntu-latest
needs: checks
if: ${{ needs.checks.outputs.should-test == 'true' }}

strategy:
fail-fast: true
matrix:
architecture: # keep this list in sync with `image-build.yaml`
- amd64
- arm64

concurrency:
group: test-image-build-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Checkout merge commit for PR${{ github.event.pull_request.number }}
uses: actions/checkout@v4

- name: Setup QEMU to be able to build on ${{ matrix.architecture }}
if: ${{ matrix.architecture != 'amd64' }}
uses: docker/setup-qemu-action@master
with:
platforms: ${{ matrix.architecture }}

- name: Test build image on ${{ matrix.architecture }}
id: test-build
uses: redhat-actions/buildah-build@main
with:
image: "tackle2-ui"
tags: pr${{ github.event.pull_request.number }}-${{ matrix.architecture }}
extra-args: "--no-cache --rm --ulimit nofile=4096:4096"
archs: ${{ matrix.architecture }}
labels: ""
containerfiles: "./Dockerfile"
context: "."
7 changes: 4 additions & 3 deletions .github/workflows/ci-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ on:
workflow_dispatch:

jobs:
unit-test-lookup-image:
unit-test-lookups:
runs-on: ubuntu-latest
outputs:
builder-image: ${{ steps.grepBuilder.outputs.builder }}

steps:
- uses: actions/checkout@v4

Expand All @@ -33,10 +34,10 @@ jobs:

unit-test:
runs-on: ubuntu-latest
needs: unit-test-lookup-image
needs: unit-test-lookups

# Use the same container as the Dockerfile's "FROM * as builder"
container: ${{ needs.unit-test-lookup-image.outputs.builder-image }}
container: ${{ needs.unit-test-lookups.outputs.builder-image }}

steps:
- uses: actions/checkout@v4
Expand Down
132 changes: 132 additions & 0 deletions .github/workflows/image-build-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Multiple Architecture Image Build 2

on:
workflow_dispatch:
push:
branches:
- "main"
- "release-*"
tags:
- "v*"

concurrency:
group: image-build-2-${{ github.ref }}
cancel-in-progress: true

env:
tag: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }}

# what is normally sent in as input
registry: "quay.io/sdickers"
image_name: "tackle2-ui"
containerfile: "./Dockerfile"
extra-args: "--ulimit nofile=4096:4096"

# pre_build_cmd: |
# echo "registry=\"http://localhost:4873\"" >> .npmrc
# pre_build_cmd: |
# echo "registry=https://npm.pkg.github.com" >> .npmrc

jobs:
build:
runs-on: ubuntu-latest

# setup a npm mirror server so multiple npm installs can share fetches
# services:
# npm-mirror:
# image: verdaccio/verdaccio:5
# ports:
# - 4873:4873

strategy:
matrix:
architecture:
- "amd64"
- "arm64"
- "ppc64le"
- "s390x"

steps:
- name: Maximize disk space
shell: bash
run: |
echo "Space before clearing:"
df . -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Space after clearing:"
df . -h
- name: Checkout
uses: actions/checkout@main

- name: Configure QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: Image meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.registry }}/${{ env.image_name }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Run pre build command
shell: bash
run: "${{ env.pre_build_cmd }}"
if: "${{ env.pre_build_cmd != '' }}"

- name: Build Image
id: build
uses: redhat-actions/buildah-build@main
with:
image: ${{ env.image_name }}
tags: ${{ env.tag }}-${{ matrix.architecture }}
extra-args: "--no-cache --rm ${{ env.extra-args }}"
archs: ${{ matrix.architecture }}
labels: ${{ steps.meta.outputs.labels }}
containerfiles: ${{ env.containerfile }}

- name: Push To Quay
uses: redhat-actions/push-to-registry@main
id: push
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ env.tag }}-${{ matrix.architecture }}
username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
registry: ${{ env.registry }}

manifest:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create manifest
shell: bash
run: |
podman manifest create "${{ env.registry }}/${{ env.image_name }}:${{ env.tag }}"
for arch in $(echo '${{ env.architectures }}' | jq -r '.[]'); do
podman manifest add \
"${{ env.registry }}/${{ env.image_name }}:${{ env.tag }}" \
"${{ env.registry }}/${{ env.image_name }}:${{ env.tag }}-${arch}"
done
- name: Push To Quay
uses: redhat-actions/push-to-registry@main
id: push
with:
image: ${{ env.image_name }}
tags: ${{ env.tag }}
username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
registry: ${{ env.registry }}
6 changes: 5 additions & 1 deletion .github/workflows/image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ jobs:
image-build:
uses: konveyor/release-tools/.github/workflows/build-push-images.yaml@main
with:
registry: "quay.io/konveyor"
registry: "quay.io/sdickers"
image_name: "tackle2-ui"
containerfile: "./Dockerfile"

# keep the architectures in sync with `ci-image-build.yml`
architectures: '[ "amd64", "arm64" ]'

# 2023-03-19: currently needed for npm@10
extra-args: "--ulimit nofile=4096:4096"

secrets:
registry_username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
registry_password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
3 changes: 3 additions & 0 deletions newfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hello There
nice to see you
this is a new file
Loading