Skip to content

Commit f0088d4

Browse files
committed
Simplify
* Use GitHub Release instead of GitHub Actions' artifacts * Build directory structure in package generator not binary-task.rb
1 parent f65170a commit f0088d4

File tree

10 files changed

+173
-193
lines changed

10 files changed

+173
-193
lines changed

.github/workflows/package_linux.yml

Lines changed: 97 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
- 'format/Flight.proto'
3434
- 'testing'
3535
tags:
36-
- '**'
36+
- "apache-arrow-*-rc*"
3737
pull_request:
3838
paths:
3939
- '.dockerignore'
@@ -52,23 +52,14 @@ on:
5252
- synchronize
5353
schedule:
5454
- cron: "0 2 * * *"
55-
workflow_dispatch:
56-
inputs:
57-
version:
58-
description: "The Arrow version"
59-
type: string
60-
required: true
61-
no_rc_version:
62-
description: "The Arrow version without RC"
63-
type: string
64-
required: true
6555

6656
concurrency:
6757
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
6858
cancel-in-progress: true
6959

7060
permissions:
71-
contents: read
61+
# Upload to GitHub Release
62+
contents: write
7263

7364
jobs:
7465
check-labels:
@@ -113,14 +104,20 @@ jobs:
113104
- ubuntu-noble-arm64
114105
env:
115106
DOCKER_VOLUME_PREFIX: ".docker/"
116-
ARROW_VERSION: ${{ inputs.version || ''}}
117-
NO_RC_VERSION: ${{ inputs.no_rc_version || ''}}
118107
steps:
108+
- name: Checkout Arrow
109+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
110+
with:
111+
fetch-depth: 0
112+
submodules: recursive
119113
- name: Prepare environment variables
120114
env:
121115
ID: ${{ matrix.id }}
122116
run: |
123-
set -ex
117+
set -x
118+
# Example: almalinux-8-amd64 -> almalinux
119+
distribution="${ID%-*-*}"
120+
echo "DISTRIBUTION=${distribution}" >> "${GITHUB_ENV}"
124121
# Example: almalinux-8-amd64 -> amd64
125122
architecture="${ID##*-}"
126123
echo "ARCHITECTURE=${architecture}" >> "${GITHUB_ENV}"
@@ -129,40 +126,33 @@ jobs:
129126
case "${target}" in
130127
almalinux-*|amazon-linux-*|centos-*)
131128
echo "TASK_NAMESPACE=yum" >> "${GITHUB_ENV}"
132-
echo "UPLOAD_EXTENSIONS=rpm" >> "${GITHUB_ENV}"
133-
if [[ "${architecture}" == "arm64" ]]; then
129+
if [ "${architecture}" = "arm64" ]; then
134130
# Example: almalinux-8 -> almalinux-8-aarch64
135131
target="${target}-aarch64"
136132
fi
137133
echo "YUM_TARGETS=${target}" >> "${GITHUB_ENV}"
138134
;;
139135
*)
140136
echo "TASK_NAMESPACE=apt" >> "${GITHUB_ENV}"
141-
upload_extensions=(ddeb deb debian.tar.xz .dsc .orig.tar.gz)
142-
echo "UPLOAD_EXTENSIONS=${upload_extensions[*]}" >> "${GITHUB_ENV}"
143-
if [[ "${architecture}" == "arm64" ]]; then
137+
if [ "${architecture}" = "arm64" ]; then
144138
# Example: ubuntu-noble -> ubuntu-noble-arm64
145139
target="${target}-arm64"
146140
fi
147141
echo "APT_TARGETS=${target}" >> "${GITHUB_ENV}"
148142
;;
149143
esac
150144
echo "TARGET=${target}" >> "${GITHUB_ENV}"
151-
- name: Checkout Arrow
152-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
153-
with:
154-
fetch-depth: 0
155-
submodules: recursive
156-
- name: Free up disk space
157-
if: runner.os == 'Linux' && runner.arch == 'X64'
158-
shell: bash
159-
run: |
160-
ci/scripts/util_free_space.sh
145+
146+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
147+
# Example: apache-arrow-21.0.0-rc0 -> 21.0.0-rc0
148+
version="${GITHUB_REF_NAME#apache-arrow-}"
149+
echo "ARROW_VERSION=${version}" >> "${GITHUB_ENV}"
150+
fi
161151
- name: Cache Docker Volumes
162152
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
163153
with:
164154
path: .docker
165-
key: package-linux-${{ matrix.id }}-${{ hashFiles('cpp/**') }}
155+
key: package-linux-${{ matrix.id }}-${{ hashFiles('cpp/**', 'c_glib/**') }}
166156
restore-keys: package-linux-${{ matrix.id }}-
167157
- name: Set up Ruby
168158
run: |
@@ -172,91 +162,106 @@ jobs:
172162
ruby \
173163
ruby-dev
174164
- name: Prepare apache-arrow-apt-source for arm64
175-
if: ${{ env.ARCHITECTURE == 'arm64' }}
165+
if: env.ARCHITECTURE == 'arm64'
176166
run: |
177167
pushd dev/tasks/linux-packages/apache-arrow-apt-source/apt
178168
for target in *-*; do
179169
cp -a ${target} ${target}-arm64
180170
done
181171
popd
182172
- name: Prepare apache-arrow-release for arm64
183-
if: ${{ env.ARCHITECTURE == 'arm64' }}
173+
if: env.ARCHITECTURE == 'arm64'
184174
run: |
185175
pushd dev/tasks/linux-packages/apache-arrow-release/yum
186176
for target in *-*; do
187177
cp -a ${target} ${target}-aarch64
188178
done
189179
popd
190-
- name: Get Arrow Version
191-
id: get-arrow-version
192-
run: |
193-
# In case of dev (no workflow_dispatch inputs) compute ARROW_VERSION and
194-
# use the same version for NO_RC_VERSION.
195-
if [ -z "${ARROW_VERSION}" ]; then
196-
ARROW_VERSION=$(git describe --tags --abbrev=0 --match "apache-arrow-[0-9]*.*" | sed 's/^apache-arrow-//')
197-
ARROW_VERSION="${ARROW_VERSION}$(date +%Y%m%d)"
198-
echo "ARROW_VERSION=${ARROW_VERSION}" >> $GITHUB_ENV
199-
echo "NO_RC_VERSION=${ARROW_VERSION}" >> $GITHUB_ENV
200-
fi
201-
- name: Build
180+
- name: Update version
181+
if: github.ref_type != 'tag'
202182
run: |
203-
set -e
204183
pushd dev/tasks/linux-packages
205-
rake version:update ARROW_RELEASE_TIME="$(date --iso-8601=seconds)"
206-
rake docker:pull || :
207-
rake --trace ${TASK_NAMESPACE}:build BUILD_DIR=build
184+
rake version:update
208185
popd
209-
env:
210-
REPO: ghcr.io/${{ github.repository }}-package-linux
211-
- name: Login to Dockerhub
212-
if: >-
213-
success() &&
214-
github.event_name == 'push' &&
215-
github.repository == 'apache/arrow' &&
216-
github.ref_name == 'main'
186+
- name: Login to GitHub Container registry
217187
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
218188
with:
219189
registry: ghcr.io
220190
username: ${{ github.actor }}
221-
password: ${{ secrets.GITHUB_TOKEN}}
191+
password: ${{ secrets.GITHUB_TOKEN }}
192+
- name: Wait for creating GitHub Release
193+
if: github.ref_type == 'tag'
194+
run: |
195+
dev/release/utils-watch-gh-workflow.sh \
196+
${GITHUB_REF_NAME} \
197+
release_candidate.yml
198+
- name: Build
199+
run: |
200+
pushd dev/tasks/linux-packages
201+
rake docker:pull || :
202+
rake --trace ${TASK_NAMESPACE}:build BUILD_DIR=build
203+
popd
222204
- name: Docker Push
223205
continue-on-error: true
224206
if: >-
225207
success() &&
226208
github.event_name == 'push' &&
227-
github.repository == 'apache/arrow' &&
228209
github.ref_name == 'main'
229-
shell: bash
230210
run: |
231211
pushd dev/tasks/linux-packages
232212
rake docker:push
233213
popd
234-
env:
235-
REPO: ${{ secrets.REPO }}
236214
- name: Build artifact tarball
237-
shell: bash
238215
run: |
239-
set -ex
240-
pushd dev/tasks/linux-packages
241-
tar cvzf ${{ matrix.id }}.tar.gz */${TASK_NAMESPACE}/repositories
242-
popd
216+
mkdir -p "${DISTRIBUTION}"
217+
cp -a \
218+
dev/tasks/linux-packages/*/${TASK_NAMESPACE}/repositories/${DISTRIBUTION}/* \
219+
"${DISTRIBUTION}/"
220+
# We use latest .deb/.rpm of
221+
# apache-arrow-apt-source/apache-arrow-release built for
222+
# amd64 because they are architecture independent.
223+
if [ "${ARCHITECTURE}" = "amd64" ]; then
224+
if [ "${APT_TASK_NAMESPACE}" = "apt" ]; then
225+
# Example: debian-bookworm-amd64 -> debian-bookworm
226+
code_name="${ID%-*}"
227+
# Example: debian-bookworm -> bookworm
228+
code_name="${code_name#*-}"
229+
# Create
230+
# https://packages.apache.org/artifactory/arrow/${DISTRIBUTION}/apache-arrow-apt-source-latest-${code_name}.deb
231+
# for easy to install.
232+
cp -a \
233+
"${DISTRIBUTION}/pool/${code_name}/a/apache-arrow-apt-source/*.deb \
234+
"${DISTRIBUTION}/apache-arrow-apt-source-latest-${code_name}.deb"
235+
else
236+
# Example: amazon-linux-2023-amd64 -> amazon-linux-2023
237+
version="${ID%-*}"
238+
# Example: amazon-linux-2023 -> 2023
239+
version="${version##*-}"
240+
# Create
241+
# https://packages.apache.org/artifactory/arrow/${DISTRIBUTION}/${version}/apache-arrow-release-latest.rpm
242+
# for easy to install.
243+
cp -a \
244+
"${DISTRIBUTION}/${version}/x86_64/Packages/apache-arrow-release-*.rpm \
245+
"${DISTRIBUTION}/${version}/apache-arrow-release-latest.rpm"
246+
fi
247+
fi
248+
tar cvzf ${{ matrix.id }}.tar.gz ${DISTRIBUTION}
249+
dev/release/utils-generate-checksum.sh ${{ matrix.id }}.tar.gz
243250
- name: Upload the artifacts to the job
244251
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
245252
with:
246253
name: ${{ matrix.id }}
247-
path: dev/tasks/linux-packages/${{ matrix.id }}.tar.gz
248-
- name: Download Artifacts
249-
uses: actions/download-artifact@v4
250-
with:
251-
path: artifacts-downloaded
252-
name: ${{ matrix.id }}
254+
path: ${{ matrix.id }}.tar.gz*
255+
- name: Upload the artifacts to GitHub Release
256+
if: github.ref_type == 'tag'
257+
env:
258+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
259+
run: |
260+
gh release upload ${GITHUB_REF_NAME} \
261+
--clobber \
262+
${{ matrix.id }}.tar.gz*
253263
- name: Set up test
254264
run: |
255-
mv artifacts-downloaded/* dev/tasks/linux-packages
256-
pushd dev/tasks/linux-packages
257-
rm -rf */${TASK_NAMESPACE}/repositories # Remove artifacts
258-
tar xf ${{ matrix.id }}.tar.gz # Use uploaded artifacts
259-
popd
260265
sudo apt install -y \
261266
apt-utils \
262267
cpio \
@@ -266,27 +271,25 @@ jobs:
266271
rpm \
267272
rsync
268273
gem install --user-install apt-dists-merge
269-
(echo "Key-Type: RSA"; \
270-
echo "Key-Length: 4096"; \
271-
echo "Name-Real: Test"; \
272-
echo "Name-Email: [email protected]"; \
273-
echo "%no-protection") | \
274-
gpg --full-generate-key --batch
274+
{
275+
echo "Key-Type: RSA"
276+
echo "Key-Length: 4096"
277+
echo "Name-Real: Test"
278+
echo "Name-Email: [email protected]"
279+
echo "%no-protection"
280+
} | gpg --full-generate-key --batch
275281
GPG_KEY_ID=$(gpg --list-keys --with-colon [email protected] | grep fpr | cut -d: -f10)
276282
echo "GPG_KEY_ID=${GPG_KEY_ID}" >> ${GITHUB_ENV}
277-
case "${{ matrix.id }}" in
278-
almalinux-*|amazon-linux-*|centos-*)
279-
repositories_dir=dev/tasks/linux-packages/apache-arrow-release/yum/repositories
280-
rpm2cpio ${repositories_dir}/*/*/*/Packages/apache-arrow-release-*.rpm | \
281-
cpio -id
282-
mv etc/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow \
283-
dev/tasks/linux-packages/KEYS
284-
;;
285-
esac
283+
if [ "${TASK_NAMESPACE}" = "yum" ]; then
284+
repositories_dir=dev/tasks/linux-packages/apache-arrow-release/yum/repositories
285+
rpm2cpio ${repositories_dir}/*/*/*/Packages/apache-arrow-release-*.rpm |
286+
cpio -id
287+
mv etc/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow \
288+
dev/tasks/linux-packages/KEYS
289+
fi
286290
gpg --export --armor [email protected] >> dev/tasks/linux-packages/KEYS
287291
- name: Test
288292
run: |
289-
set -e
290293
pushd dev/tasks/linux-packages
291294
rake --trace ${TASK_NAMESPACE}:test
292295
popd

.github/workflows/release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ name: Release
2020
on:
2121
push:
2222
tags:
23-
# Trigger workflow when a tag whose name matches the pattern
24-
# pattern "apache-arrow-{MAJOR}.{MINOR}.{PATCH}" is pushed.
25-
- "apache-arrow-[0-9]+.[0-9]+.[0-9]+"
23+
- "apache-arrow-*"
24+
- "!apache-arrow-*-rc*"
2625

2726
permissions:
2827
contents: write

.github/workflows/release_candidate.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ on:
2323
- '**'
2424
- '!dependabot/**'
2525
tags:
26-
# Trigger workflow when a tag whose name matches the pattern
27-
# "apache-arrow-{MAJOR}.{MINOR}.{PATCH}-rc{RC_NUM}" is pushed.
28-
- "apache-arrow-[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
26+
- "apache-arrow-*-rc*"
2927
paths:
3028
- ".github/workflows/release_candidate.sh"
3129
- "dev/release/utils-create-release-tarball.sh"

dev/release/03-binary-submit.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ archery crossbow submit \
5151
--arrow-sha ${ARROW_SHA} \
5252
--group packaging
5353

54-
# Submit package_linux.yml workflow to build linux artifacts
55-
gh workflow run package_linux.yml \
56-
--ref ${ARROW_BRANCH} \
57-
-f version=${version_with_rc} \
58-
-f no_rc_version=${version}
59-
6054
# archery will add a comment to the automatically generated PR to track
6155
# the submitted jobs
6256
job_name=$(archery crossbow latest-prefix --no-fetch ${crossbow_job_prefix})

dev/release/04-binary-download.sh

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rc_number=$1
3333
shift
3434
version_with_rc="${version}-rc${rc_number}"
3535
crossbow_job_prefix="release-${version_with_rc}"
36-
release_tag="apache-arrow-${version_with_rc}"
36+
tag="apache-arrow-${version_with_rc}"
3737

3838
# archery will submit a job with id: "${crossbow_job_prefix}-0" unless there
3939
# are jobs submitted with the same prefix (the integer at the end is auto
@@ -43,21 +43,13 @@ release_tag="apache-arrow-${version_with_rc}"
4343

4444
archery crossbow download-artifacts --no-fetch ${CROSSBOW_JOB_ID} "$@"
4545

46-
# Wait for the GitHub Workflow that creates the Linux packages
47-
# to finish before downloading the artifacts.
48-
. "${SOURCE_DIR}/utils-watch-gh-workflow.sh" "${release_tag}" "package_linux.yml"
49-
50-
RUN_ID=$(get_run_id)
51-
# Download the artifacts created by the package_linux.yml workflow
52-
download_artifacts "${SOURCE_DIR}/../../packages/${CROSSBOW_JOB_ID}"
53-
54-
# Find and extract all .tar.gz files in their own artifact directory
55-
find "${SOURCE_DIR}/../../packages/${CROSSBOW_JOB_ID}" -name "*.tar.gz" -type f | while read -r tarfile; do
56-
echo "Extracting: ${tarfile}"
57-
tarfile_dir=$(dirname "${tarfile}")
58-
59-
# Extract to the same directory as the tar.gz file
60-
tar -xzf "${tarfile}" -C "${tarfile_dir}"
61-
# Should we remove the tar.gz file after extraction?
62-
# rm "${tarfile}"
63-
done
46+
# Download Linux packages.
47+
gh release download "${tag}" \
48+
--dir "${crossbow_job_prefix}" \
49+
--pattern "almalinux-*.tar.gz" \
50+
--pattern "amazon-linux-*.tar.gz" \
51+
--pattern "centos-*.tar.gz" \
52+
--pattern "debian-*.tar.gz" \
53+
--pattern "ubuntu-*.tar.gz" \
54+
--repo "${REPOSITORY:-apache/arrow}" \
55+
--skip-existing

0 commit comments

Comments
 (0)