Skip to content

HDDS-11148. Add smoketest for ozone-runner image CI #91

HDDS-11148. Add smoketest for ozone-runner image CI

HDDS-11148. Add smoketest for ozone-runner image CI #91

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI
on:
push:
pull_request:
types: [opened, ready_for_review, synchronize]
env:
OZONE_RUNNER_IMAGE: ${{ github.repository_owner }}/ozone-runner
OZONE_RUNNER_VERSION: ci-${{ github.run_number }}
OZONE_VERSION: 1.4.0
# Test push only in forks;
# after push in apache, the image should be tested with complete Ozone CI.
# This condition is duplicated in 'acceptance' job's 'if' condition (cannot use env context there).
NEEDS_TEST: ${{ github.repository_owner != 'apache' || github.event_name == 'pull_request' }}
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Build image
run: |
tag="$OZONE_RUNNER_IMAGE":"$OZONE_RUNNER_VERSION"
DOCKER_BUILDKIT=1 docker build -t $tag .
- name: List images
run: |
docker image ls
- name: Save image as tarball
if: ${{ env.NEEDS_TEST }}
run: |
docker image save -o image.tar "$OZONE_RUNNER_IMAGE":"$OZONE_RUNNER_VERSION"
ls -lh image.tar
- name: Upload image for testing
uses: actions/upload-artifact@v4
if: ${{ env.NEEDS_TEST }}
with:
name: image
path: image.tar
retention-days: 1
acceptance:
runs-on: ubuntu-20.04
if: ${{ github.repository_owner != 'apache' || github.event_name == 'pull_request' }}
needs: build-image
strategy:
matrix:
suite:
- HA-unsecure # can add more later
fail-fast: false
steps:
- name: Download Ozone ${{ env.OZONE_VERSION }}
run: |
curl -LSs -o ozone-src.tar.gz https://dlcdn.apache.org/ozone/${OZONE_VERSION}/ozone-${OZONE_VERSION}-src.tar.gz
curl -LSs -o ozone.tar.gz https://dlcdn.apache.org/ozone/${OZONE_VERSION}/ozone-${OZONE_VERSION}.tar.gz
tar -xvz --strip-components 1 -f ozone-src.tar.gz
mkdir -p hadoop-ozone/dist/target
tar -xvz -C hadoop-ozone/dist/target -f ozone.tar.gz
sudo chmod -R a+rwX hadoop-ozone/dist/target
rm -f ozone.tar.gz ozone-src.tar.gz
- name: Download image
uses: actions/download-artifact@v4
with:
name: image
- name: Load image
run: |
ls -lh image.tar
docker image load -i image.tar
rm -f image.tar
- name: List images
run: |
docker image ls
- name: Compatibility hacks
run: |
# Can be removed after release with HDDS-9031 (1.4.1 or later)
cd hadoop-ozone/dist/target/ozone-${OZONE_VERSION}
curl -LSs -o compose-v2.patch https://github.com/apache/ozone/commit/d80c45bb35bc3012d7f26f66e42d847672782aee.diff
patch -p5 < compose-v2.patch
- name: Execute tests
run: |
pushd hadoop-ozone/dist/target/ozone-*
sudo mkdir .aws && sudo chmod 777 .aws && sudo chown 1000 .aws
popd
./hadoop-ozone/dev-support/checks/acceptance.sh
env:
OZONE_ACCEPTANCE_SUITE: ${{ matrix.suite }}
OZONE_VOLUME_OWNER: 1000
continue-on-error: true
- name: Summary of failures
run: hadoop-ozone/dev-support/checks/_summary.sh target/${{ github.job }}/summary.txt
if: ${{ !cancelled() }}
- name: Archive build results
uses: actions/upload-artifact@v4
if: always()
with:
name: acceptance-${{ matrix.suite }}
path: target/acceptance
continue-on-error: true