Skip to content

Commit 91205ef

Browse files
committed
integration & orchestration jobs improved.
1 parent c13e2d1 commit 91205ef

15 files changed

+177
-146
lines changed

.github/workflows/reusable-docker.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ jobs:
7373
ENV_VARS: '--env REPO_USER="${{ INPUTS.USERNAME }}" --env REPO_NAME="${{ INPUTS.REPOSITORY }}" --env REPO_BRANCH="${{ INPUTS.BRANCH }}" --env RUNNER_UID="${{ INPUTS.RUNNER_UID }}" --env RUNNER_GID="${{ INPUTS.RUNNER_GID }}"'
7474
steps:
7575

76+
- shell: bash
77+
id: setup
78+
run: |
79+
PLATFORM='${{ INPUTS.PLATFORM }}'
80+
ARTIFACT_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}-rhel9-${PLATFORM#linux/}-unsigned
81+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
82+
echo "::group::Setup Info"
83+
echo "::notice file=reusable-docker.yml,line={83},title=Artifact Name: ${ARTIFACT_NAME}"
84+
echo "::endgroup::"
85+
7686
# https://github.com/docker/login-action
7787
- name: Log in to the Container registry
7888
uses: 'docker/login-action@v3'
@@ -95,7 +105,7 @@ jobs:
95105
# https://docs.docker.com/reference/cli/docker/container/run/
96106
# https://docs.docker.com/reference/cli/docker/container/cp/
97107
# --entrypoint ${{ INPUTS.ENTRY-POINT }} cannot be changed with GitHub docker.
98-
- name: Run ${{ INPUTS.REGISTRY }}/${{ INPUTS.USERNAME }}/${{ INPUTS.IMAGE }} with ${{ INPUTS.USERNAME }} / ${{ INPUTS.REPOSITORY }} / ${{ INPUTS.BRANCH }}
108+
- name: Run image ${{ INPUTS.REGISTRY }}/${{ INPUTS.USERNAME }}/${{ INPUTS.IMAGE }} with source https://github.com/${{ INPUTS.USERNAME }}/${{ INPUTS.REPOSITORY }}.git#${{ INPUTS.BRANCH }}
99109
id: build-rpm-packages
100110
shell: bash
101111
env:
@@ -111,7 +121,7 @@ jobs:
111121
if: ${{ success() }}
112122
id: retain-rpm-packages
113123
with:
114-
name: ${{ INPUTS.REPOSITORY }}-rhel9-${{ RUNNER.ARCH }}-unsigned
124+
name: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_NAME }}
115125
path: "${{ RUNNER.TEMP }}/.rpms"
116126
include-hidden-files: 'true'
117127
retention-days: 14
@@ -120,7 +130,10 @@ jobs:
120130
id: list-rpm-packages
121131
shell: bash
122132
run: |
123-
[ "$(ls -1 ${{ RUNNER.TEMP }}/.rpms/*.rpm 2>/dev/null | wc -l)" -lt 4 ] && echo "::warning file=reusable-docker.yml,title=RPM Build::Less than 4 ${{ INPUTS.REPOSITORY }} RPM packages were built."
133+
if [ "$(ls -1 ${{ RUNNER.TEMP }}/.rpms/*.rpm 2>/dev/null | wc -l)" -lt 4 ]; then
134+
echo "::warning file=reusable-docker.yml,line=134,title=RPM Build::Less than the expected 4 RPM packages were built."
135+
# for FILE in ${{ RUNNER.TEMP }}/.rpms/*.rpm; do echo "::notice file=reusable-docker.yml,line=136,title=${FILE}"; done
136+
fi
124137
printf "Ubuntu mount-point: %s" "${{ RUNNER.TEMP }}/.rpms"
125138
ls -la ${{ RUNNER.TEMP }}/.rpms
126139
ls -lan ${{ RUNNER.TEMP }}/.rpms

.github/workflows/rhel-integration.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ jobs:
4949
DOCKER_IMAGE: ${{ INPUTS.REGISTRY }}/${{ INPUTS.USERNAME }}/${{ INPUTS.IMAGE }}
5050
steps:
5151

52-
# https://github.com/actions/download-artifact
53-
- uses: 'actions/download-artifact@v4'
54-
id: restore-rpm-packages
55-
with:
56-
name: ${{ INPUTS.REPOSITORY }}-rhel9-${{ RUNNER.ARCH }}-unsigned
57-
path: '${{ RUNNER.TEMP }}/.rpms'
58-
59-
- name: List directory ${{ RUNNER.TEMP }}/.rpms
60-
id: list-rpm-packages
61-
shell: bash
62-
run: |
63-
printf "Ubuntu mount-point: %s" "${{ RUNNER.TEMP }}/.rpms"
64-
ls -la ${{ RUNNER.TEMP }}/.rpms
65-
ls -lan ${{ RUNNER.TEMP }}/.rpms
66-
6752
- uses: 'docker/login-action@v3'
6853
id: container-registry
6954
with:
@@ -87,11 +72,34 @@ jobs:
8772
if: ${{ INPUTS.PLATFORM != 'linux/amd64' }}
8873
with: { platforms: arm64 }
8974

90-
- shell: bash
75+
- name: Run shell script, which determines the artifact name
76+
shell: bash
9177
id: setup
9278
run: |
9379
echo "RUNNER_GID=$(id -g)" >> $GITHUB_OUTPUT
9480
echo "RUNNER_UID=$(id -u)" >> $GITHUB_OUTPUT
81+
PLATFORM='${{ INPUTS.PLATFORM }}'
82+
ARTIFACT_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}-rhel9-${PLATFORM#linux/}-unsigned
83+
echo "ARTIFACT_PATH=${{ GITHUB.WORKSPACE }}/.rpms" >> $GITHUB_OUTPUT
84+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
85+
echo "::group::Setup Info"
86+
echo "::notice file=rhel-integration.yml,line={85},title=Artifact Name: ${ARTIFACT_NAME}"
87+
echo "::endgroup::"
88+
89+
# https://github.com/actions/download-artifact
90+
- uses: 'actions/download-artifact@v4'
91+
id: restore-rpm-packages
92+
with:
93+
name: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_NAME }}
94+
path: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
95+
96+
- name: List directory ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
97+
id: list-rpm-packages
98+
shell: bash
99+
run: |
100+
echo "Runner directory: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}"
101+
ls -la ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
102+
ls -lan ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
95103
96104
- uses: 'docker/build-push-action@v6'
97105
id: build
@@ -107,6 +115,11 @@ jobs:
107115
RUNNER_GID=${{ STEPS.SETUP.OUTPUTS.RUNNER_GID }}
108116
RUNNER_UID=${{ STEPS.SETUP.OUTPUTS.RUNNER_UID }}
109117
LINUX_IMAGE=${{ VARS.RHEL_LINUX_IMAGE }}
118+
GITHUB_USER=${{ GITHUB.REPOSITORY_OWNER }}
119+
GITHUB_REPO=${{ STEPS.SETUP.OUTPUTS.REPOSITORY_NAME }}
120+
GITHUB_BRANCH=${{ GITHUB.HEAD_REF || GITHUB.REF_NAME }}
121+
# Setting the artifact path is required for local & remote compatibility.
122+
# ARTIFACT_PATH=${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
110123
111124
# Note: The digest comes from `buildx`, not the metadata.
112125
# https://github.com/actions/attest-build-provenance

.github/workflows/rhel-orchestration.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,6 @@ jobs:
5050
ARTIFACT_NAME: ${{ NEEDS.SETUP.OUTPUTS.ARTIFACT_NAME }}
5151
steps:
5252

53-
# https://github.com/actions/download-artifact
54-
- uses: 'actions/download-artifact@v4'
55-
id: restore-rpm-packages
56-
with:
57-
name: ${{ INPUTS.REPOSITORY }}-rhel9-${{ RUNNER.ARCH }}-unsigned
58-
path: '${{ RUNNER.TEMP }}/.rpms'
59-
60-
- name: List directory ${{ RUNNER.TEMP }}/.rpms
61-
id: list-rpm-packages
62-
shell: bash
63-
run: |
64-
printf "Ubuntu mount-point: %s" "${{ RUNNER.TEMP }}/.rpms"
65-
ls -la ${{ RUNNER.TEMP }}/.rpms
66-
ls -lan ${{ RUNNER.TEMP }}/.rpms
67-
6853
- uses: 'docker/login-action@v3'
6954
id: container-registry
7055
with:
@@ -81,15 +66,42 @@ jobs:
8166
type=sha
8267
latest
8368
84-
- shell: bash
69+
# https://github.com/marketplace/actions/build-and-push-docker-images
70+
- uses: 'actions/checkout@v4'
71+
- uses: 'docker/setup-buildx-action@v3'
72+
- uses: 'docker/setup-qemu-action@v3'
73+
if: ${{ INPUTS.PLATFORM != 'linux/amd64' }}
74+
with: { platforms: arm64 }
75+
76+
- name: Run shell script, which determines the artifact name
77+
shell: bash
8578
id: setup
8679
run: |
8780
echo "RUNNER_GID=$(id -g)" >> $GITHUB_OUTPUT
8881
echo "RUNNER_UID=$(id -u)" >> $GITHUB_OUTPUT
82+
PLATFORM='${{ INPUTS.PLATFORM }}'
83+
ARTIFACT_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}-rhel9-${PLATFORM#linux/}-unsigned
84+
echo "ARTIFACT_PATH=${{ GITHUB.WORKSPACE }}/.rpms" >> $GITHUB_OUTPUT
85+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
86+
echo "::group::Setup Info"
87+
echo "::notice file=rhel-orchestration.yml,line={86},title=Artifact Name: ${ARTIFACT_NAME}"
88+
echo "::endgroup::"
89+
90+
# https://github.com/actions/download-artifact
91+
- uses: 'actions/download-artifact@v4'
92+
id: restore-rpm-packages
93+
with:
94+
name: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_NAME }}
95+
path: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
96+
97+
- name: List directory ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
98+
id: list-rpm-packages
99+
shell: bash
100+
run: |
101+
echo "Runner directory: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}"
102+
ls -la ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
103+
ls -lan ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
89104
90-
# https://github.com/marketplace/actions/build-and-push-docker-images
91-
- uses: 'actions/checkout@v4'
92-
- uses: 'docker/setup-buildx-action@v3'
93105
- uses: 'docker/build-push-action@v6'
94106
id: build
95107
with:
@@ -104,6 +116,11 @@ jobs:
104116
RUNNER_GID=${{ STEPS.SETUP.OUTPUTS.RUNNER_GID }}
105117
RUNNER_UID=${{ STEPS.SETUP.OUTPUTS.RUNNER_UID }}
106118
LINUX_IMAGE=${{ VARS.RHEL_LINUX_IMAGE }}
119+
GITHUB_USER=${{ GITHUB.REPOSITORY_OWNER }}
120+
GITHUB_REPO=${{ STEPS.SETUP.OUTPUTS.REPOSITORY_NAME }}
121+
GITHUB_BRANCH=${{ GITHUB.HEAD_REF || GITHUB.REF_NAME }}
122+
# Setting the artifact path is required for local & remote compatibility.
123+
# ARTIFACT_PATH=${{ STEPS.SETUP.OUTPUTS.ARTIFACT_PATH }}
107124
108125
# Note: The digest comes from `buildx`, not the metadata.
109126
# https://github.com/actions/attest-build-provenance

.github/workflows/rpm-builder.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ jobs:
3535
runner: ${{ VARS.RUNNER_ARM }}
3636
image: rpm-builder-arm64
3737
outputs:
38+
ARTIFACT_NAME: ${{ STEPS.SETUP.OUTPUTS.ARTIFACT_NAME }}
39+
RUNNER_GID: ${{ STEPS.SETUP.OUTPUTS.RUNNER_GID }}
3840
RUNNER_UID: ${{ STEPS.SETUP.OUTPUTS.RUNNER_UID }}
39-
RUNNER:GID: ${{ STEPS.SETUP.OUTPUTS.RUNNER_GID }}
41+
4042
steps:
4143
- uses: 'actions/checkout@v4'
4244
- uses: 'docker/login-action@v3'
@@ -61,16 +63,13 @@ jobs:
6163
if: ${{ MATRIX.PLATFORM == 'linux/arm64' }}
6264
with: { platforms: arm64 }
6365

64-
- shell: bash
66+
- name: Run shell script, which determines the repository name
67+
shell: bash
6568
id: setup
6669
run: |
70+
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_OUTPUT
6771
echo "RUNNER_GID=$(id -g)" >> $GITHUB_OUTPUT
6872
echo "RUNNER_UID=$(id -u)" >> $GITHUB_OUTPUT
69-
REPOSITORY_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}
70-
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_OUTPUT
71-
echo "::group::Setup Info"
72-
echo "::notice file=rpm-builder.yml,title=Repository: $REPOSITORY_NAME"
73-
echo "::endgroup::"
7473
7574
- uses: 'docker/build-push-action@v6'
7675
id: build
@@ -83,12 +82,12 @@ jobs:
8382
labels: ${{ STEPS.METADATA.OUTPUTS.LABELS }}
8483
tags: ${{ STEPS.METADATA.OUTPUTS.TAGS }}
8584
build-args: |
86-
GITHUB_USER=${{ GITHUB.REPOSITORY_OWNER }}
87-
GITHUB_REPO=${{ STEPS.SETUP.OUTPUTS.REPOSITORY_NAME }}
88-
GITHUB_BRANCH=${{ GITHUB.HEAD_REF || GITHUB.REF_NAME }}
8985
RUNNER_GID=${{ STEPS.SETUP.OUTPUTS.RUNNER_GID }}
9086
RUNNER_UID=${{ STEPS.SETUP.OUTPUTS.RUNNER_UID }}
9187
LINUX_IMAGE=${{ VARS.RHEL_LINUX_IMAGE }}
88+
GITHUB_USER=${{ GITHUB.REPOSITORY_OWNER }}
89+
GITHUB_REPO=${{ STEPS.SETUP.OUTPUTS.REPOSITORY_NAME }}
90+
GITHUB_BRANCH=${{ GITHUB.HEAD_REF || GITHUB.REF_NAME }}
9291
9392
# Note: The digest comes from `buildx`, not the metadata.
9493
# https://github.com/actions/attest-build-provenance

docker/rhel-integration/Dockerfile

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# Dockerfile based on `rockylinux/rockylinux:9.5`
1+
# RHEL Integration Dockerfile based on `rockylinux/rockylinux:9.5`
22
ARG LINUX_IMAGE=rockylinux/rockylinux:9.5
33
FROM $LINUX_IMAGE AS base_image
44
LABEL description="RHEL Integration"
55
LABEL version="1.0.2"
66
LABEL repository="https://github.com/google/android-cuttlefish"
77
LABEL maintainer="Martin Zeitler"
88
SHELL [ "/bin/bash", "-c" ]
9+
WORKDIR "/root"
10+
USER "root"
911

1012
# Arguments
1113
ARG RUNNER_GID="118"
@@ -22,15 +24,21 @@ RUN [ "echo", "%docker", "ALL=(ALL)", "NOPASSWD:", "ALL", ">", "/etc/sudoers.d/d
2224

2325
# The EPEL repository installs `dnf-core-plugin` (`config-manager` and `builddeps`) and provides `ncurses-compat-libs`.
2426
# Configuring further package repositories: / https://wiki.rockylinux.org/rocky/repo/#extra-repositories
25-
RUN [ "dnf", "-y", "install", "https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm" ]
27+
RUN [ "dnf", "-y", "install", "sudo", "nano", "wget", "https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm"]
2628
RUN [ "rm", "/etc/yum.repos.d/epel-cisco-openh264.repo" ]
2729
RUN [ "dnf", "config-manager", "--set-enabled", "crb" ]
2830
RUN [ "dnf", "-y", "upgrade" ]
2931
RUN [ "dnf", "clean", "all" ]
3032

33+
# Import Google RPM repository public key.
34+
# https://www.google.com/linuxrepositories/
35+
# RUN [ "wget", "https://dl.google.com/linux/linux_signing_key.pub" ]
36+
# RUN [ "rpm", "--import", "linux_signing_key.pub" ]
37+
3138

3239
# Integration
3340
FROM base_image AS integration
41+
ARG ARTIFACT_PATH=./.rpms
3442

3543
# Provide an interactive shell.
3644
ENTRYPOINT [ "/bin/bash" ]
@@ -47,30 +55,21 @@ EXPOSE 15550-15560
4755
# Expose ADB
4856
EXPOSE 6520-6620
4957

50-
# https://docs.docker.com/reference/dockerfile/#notes-about-specifying-volumes
51-
# The host directory is declared at container run-time, with `--volume`, eg.
52-
# --volume /home/username/android-cuttlefish/.rpms/:/home/github/.rpms
53-
RUN [ "mkdir", "/home/runner/.rpms" ]
54-
VOLUME [ "/home/runner/.rpms" ]
55-
WORKDIR "/home/runner"
58+
# Restore build artifacts.
59+
RUN [ "mkdir", "/root/.rpms" ]
60+
RUN [ "touch", "/root/.dockerenv", "/home/runner/.dockerenv" ]
61+
COPY [ "${ARTIFACT_PATH}/cuttlefish-integration-*", "/root/.rpms" ]
62+
COPY [ "${ARTIFACT_PATH}/cuttlefish-user-*", "/root/.rpms/" ]
63+
COPY [ "${ARTIFACT_PATH}/cuttlefish-base-*", "/root/.rpms/" ]
5664

57-
# Import Google RPM repository public key.
58-
# https://www.google.com/linuxrepositories/
59-
RUN [ "dnf", "-y", "install", "wget"]
60-
RUN [ "wget", "https://dl.google.com/linux/linux_signing_key.pub" ]
61-
RUN [ "rpm", "--import", "linux_signing_key.pub" ]
62-
63-
# Add prebuilt RPM packages and install them.
64-
RUN [ "touch", "/home/runner/.dockerenv" ]
65-
COPY [ "/home/runner/work/_temp/.rpms/cuttlefish-integration-*", "/home/runner/.rpms/" ]
66-
COPY [ "/home/runner/work/_temp/.rpms/cuttlefish-user-*", "/home/runner/.rpms/" ]
67-
COPY [ "/home/runner/work/_temp/.rpms/cuttlefish-base-*", "/home/runner/.rpms/" ]
68-
# COPY [ "./.rpms/cuttlefish-integration-*", "/home/runner/.rpms/" ]
69-
# COPY [ "./.rpms/cuttlefish-user-*", "/home/runner/.rpms/" ]
70-
# COPY [ "./.rpms/cuttlefish-base-*", "/home/runner/.rpms/" ]
71-
72-
RUN for FILE in /home/runner/.rpms/* ; do dnf -y install $FILE; done
65+
# Container scripts.
66+
COPY [ "./docker/rpm-builder/scripts/install_rpm.sh", "/root/install_rpm.sh" ]
67+
RUN [ "chmod", "+x", "/root/install_rpm.sh" ]
68+
69+
# Install RPM.
70+
RUN [ "/bin/bash", "-c", "/root/install_rpm.sh" ]
7371
RUN [ "dnf", "clean", "all" ]
7472

75-
# Run commands as user `runner`, who is the owner of the RPM packages.
73+
# Run commands as user `runner`.
74+
WORKDIR "/home/runner"
7675
USER "runner"

docker/rhel-integration/preinstall.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#!/usr/bin/env bash
22

33
# It builds the RPM packages and then spins up a container with these preinstalled.
4-
# `scripts/install.sh` produces a bloated image, unless mounting `/root/.cache` directory
54
REPO_DIR="$(realpath "$(dirname "$0")/../..")"
6-
cd "${REPO_DIR}/docker/rpm-builder-integration" || exit
5+
cd "${REPO_DIR}/docker/rhel-integration" || exit
76
PACKAGES="${REPO_DIR}/tools/rpmbuild/RPMS/x86_64"
87
PLATFORM="linux/amd64"
9-
108
if [ "$(uname -i)" = "aarch64" ]; then
119
PACKAGES="${REPO_DIR}/tools/rpmbuild/RPMS/aarch64"
1210
PLATFORM="linux/arm64"
@@ -18,9 +16,9 @@ fi
1816

1917
# And then build the Docker image, which depends on these.
2018
docker buildx create --use
21-
docker buildx create --append --file docker/rpm-builder-integration/Dockerfile
19+
docker buildx create --append --file docker/rhel-integration/Dockerfile
2220
docker buildx create --append --name android-cuttlefish rhel-integration
2321
docker buildx create --append --tag android-cuttlefish/rhel-integration:latest
24-
docker buildx create --append --tag android-cuttlefish/rhel-integration:1.3.0
22+
docker buildx create --append --tag android-cuttlefish/rhel-integration:1.4.0
2523
docker buildx create --append --platform $PLATFORM
2624
docker buildx build

0 commit comments

Comments
 (0)