You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by fa...@apache.org on 2026/05/05 03:00:30 UTC
(hadoop) 01/02: HADOOP-19877: ci: create composite actions for creating builder image
This is an automated email from the ASF dual-hosted git repository.
ajfabbri pushed a commit to branch af/hadoop-19877
in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit e365c69e6ae02fa9284c31c61a1cd5fbff130341
Author: Aaron Fabbri <fa...@apache.org>
AuthorDate: Mon May 4 19:25:16 2026 -0700
HADOOP-19877: ci: create composite actions for creating builder image
---
.github/actions/build_image/action.yml | 62 ++++++++++++++++++++++++++++++
.github/actions/build_image_url/action.yml | 27 +++++++++++++
.github/workflows/tmpl_build_and_test.yml | 1 +
3 files changed, 90 insertions(+)
diff --git a/.github/actions/build_image/action.yml b/.github/actions/build_image/action.yml
new file mode 100644
index 00000000000..538df067705
--- /dev/null
+++ b/.github/actions/build_image/action.yml
@@ -0,0 +1,62 @@
+name: Create hadoop build image
+
+inputs:
+ branch:
+ description: Git branch to use.
+ required: true
+ os:
+ description: Runner OS name
+ required: true
+ build_image_url:
+ description: URL of build (infra) image.
+ required: true
+
+outputs:
+ uid:
+ description: User ID this action ran as.
+
+runs:
+ using: composite
+ steps:
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ github.token }}
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
+ - name: Build and push ${{ inputs.os }} base build image for ${{ inputs.branch }}
+ id: docker_build_base
+ uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
+ with:
+ context: ./dev-support/docker/
+ file: ./dev-support/docker/Dockerfile_${{ inputs.os }}
+ push: true
+ tags: ${{ inputs.build_image_url }}-base
+ cache-from: type=registry,ref=ghcr.io/apache/hadoop/gha-build-${{ inputs.os }}-image-cache:${{ inputs.branch }}
+ - name: User-specific Dockerfile
+ shell: bash
+ run: |
+ USER_ID=$(id -u "${USER}")
+ GROUP_ID=$(id -g "${USER}")
+ cat > /tmp/Dockerfile.gha <<UserSpecificDocker
+ FROM ${{ inputs.build_image_url }}-base
+ RUN rm -f /var/log/faillog /var/log/lastlog
+ RUN groupadd --non-unique -g ${GROUP_ID} ${USER}
+ RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER}
+ RUN echo "${USER} ALL=NOPASSWD: ALL" > "/etc/sudoers.d/hadoop-build-${USER_ID}"
+ UserSpecificDocker
+ - name: Build and push ${{ inputs.os }} build image for ${{ inputs.branch }}
+ id: docker_build_gha
+ uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
+ with:
+ context: ./dev-support/docker/
+ file: /tmp/Dockerfile.gha
+ push: true
+ tags: ${{ inputs.build_image_url }}
+ - name: Set up Outputs
+ id: variables
+ shell: bash
+ run: |
+ echo "uid=$(id -u "${USER}")" >> $GITHUB_OUTPUT
diff --git a/.github/actions/build_image_url/action.yml b/.github/actions/build_image_url/action.yml
new file mode 100644
index 00000000000..4c870d77697
--- /dev/null
+++ b/.github/actions/build_image_url/action.yml
@@ -0,0 +1,27 @@
+name: Get Build Image URL
+description:
+
+inputs:
+ branch:
+ description: Git branch to use.
+ required: true
+ os:
+ description: Operating system to run the build on
+ required: true
+
+outputs:
+ build_image_url:
+ description: URL of build (infra) image.
+ value: ${{ steps.compute.outputs.image_url }}
+
+runs:
+ using: composite
+ steps:
+ - id: compute
+ shell: bash
+ run: |
+ # Convert to lowercase to meet Docker repo name requirement
+ REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
+ echo "build_image_url=ghcr.io/${REPO_OWNER}/gha-build-${{ inputs.os }}:${{ inputs.branch }}-${{ github.run_id }}" \
+ >> $GITHUB_OUTPUT
+
diff --git a/.github/workflows/tmpl_build_and_test.yml b/.github/workflows/tmpl_build_and_test.yml
index 1062c3e3f3d..373a79a6a99 100644
--- a/.github/workflows/tmpl_build_and_test.yml
+++ b/.github/workflows/tmpl_build_and_test.yml
@@ -71,6 +71,7 @@ env:
-Dmaven.test.failure.ignore=false
jobs:
+ # TODO: use common composite actions in .github/actions/
precondition:
name: Preparation
runs-on: ubuntu-24.04
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org