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

RANGER-4751 RANGER-4861: Enable docker builds for PRs, merges to master and run containers #303

Merged
merged 11 commits into from
Jul 22, 2024
83 changes: 82 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
cache: maven
- name: build (8)
run: mvn -T 8 clean install --no-transfer-progress -B -V
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: target-8
path: target/*

build-11:
runs-on: ubuntu-latest
Expand All @@ -55,4 +60,80 @@ jobs:
distribution: 'temurin'
cache: maven
- name: build (11)
run: mvn -T 8 clean install -P ranger-jdk11,!all,!linux --no-transfer-progress -B -V
run: mvn -T 8 clean install -pl '!knox-agent' --no-transfer-progress -B -V
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: target-11
path: target/*

docker-build:
needs:
- build-8
- build-11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download build-8 artifacts
uses: actions/download-artifact@v4
with:
name: target-8
- name: Copy artifacts for docker build
run: |
cp ranger-*.tar.gz dev-support/ranger-docker/dist
cp version dev-support/ranger-docker/dist
- name: Build all ranger-service images
run: |
cd dev-support/ranger-docker
chmod +x download-archives.sh && ./download-archives.sh
docker-compose -f docker-compose.ranger-base.yml build
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
export RANGER_DB_TYPE=postgres
docker-compose \
-f docker-compose.ranger-${RANGER_DB_TYPE}.yml \
-f docker-compose.ranger.yml \
-f docker-compose.ranger-usersync.yml \
-f docker-compose.ranger-tagsync.yml \
-f docker-compose.ranger-kms.yml \
-f docker-compose.ranger-hadoop.yml \
-f docker-compose.ranger-hbase.yml \
-f docker-compose.ranger-kafka.yml \
-f docker-compose.ranger-hive.yml \
-f docker-compose.ranger-knox.yml build
- name: Bring up containers
run: |
cd dev-support/ranger-docker
export RANGER_DB_TYPE=postgres
docker-compose \
-f docker-compose.ranger-${RANGER_DB_TYPE}.yml \
-f docker-compose.ranger.yml \
-f docker-compose.ranger-usersync.yml \
-f docker-compose.ranger-tagsync.yml \
-f docker-compose.ranger-kms.yml \
-f docker-compose.ranger-hadoop.yml \
-f docker-compose.ranger-hbase.yml \
-f docker-compose.ranger-kafka.yml \
-f docker-compose.ranger-hive.yml \
-f docker-compose.ranger-knox.yml up -d
- name: Check status of containers and remove them
run: |
sleep 60
containers=(ranger ranger-zk ranger-solr ranger-postgres ranger-usersync ranger-tagsync ranger-kms ranger-hadoop ranger-hbase ranger-kafka ranger-hive ranger-knox);
flag=true;
for container in "${containers[@]}"; do
if [[ $(docker inspect -f '{{.State.Running}}' $container 2>/dev/null) == "true" ]]; then
echo "Container $container is running!";
else
flag=false;
echo "Container $container is NOT running!";
fi
done

if [[ $flag == true ]]; then
echo "All required containers are up and running";
docker stop $(docker ps -q) && docker rm $(docker ps -aq);
else
docker stop $(docker ps -q) && docker rm $(docker ps -aq);
exit 1;
fi