Diffstat (limited to 'Jenkinsfile')
| -rw-r--r-- | Jenkinsfile | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index 1ab3e47..63e7c34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -118,31 +118,22 @@ spec: rpmdev-setuptree - # The published file names are whatever the spec + # The published file name is whatever the spec # resolves to under the tag's versions, so the two - # cannot drift. Note the plural: kernel-surface-dtb - # is a separate package because the main one is - # installonly and cannot own a path that carries no - # kernel version. Publishing only the first would - # leave the kernel unresolvable. - prefix="s3://${RPM_BUCKET}/fedora/${fedora_version}/aarch64" - rpm_files=$(rpmspec -q \\ + # cannot drift. A kernel build is expensive; if this + # exact NEVRA is already in the bucket, skip + # straight to the metadata. + rpm_file=$(rpmspec -q \\ --define "upstream_ver ${UPSTREAM_VER}" \\ --define "patchset_ver ${PATCHSET_VER}" \\ --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm\\n' \\ - kernel-surface.spec) + kernel-surface.spec | head -n1) + dest="s3://${RPM_BUCKET}/fedora/${fedora_version}/aarch64/${rpm_file}" - # A kernel build is expensive; skip it only when - # every one of those is already in the bucket. - skip_build=true - for rpm_name in ${rpm_files}; do - if ! aws s3 ls --endpoint-url "${B2_ENDPOINT}" \\ - "${prefix}/${rpm_name}"; then - skip_build=false - fi - done - if [ "${skip_build}" = true ]; then - echo "${TAG_NAME} is already published in full, skipping build" + skip_build=false + if aws s3 ls --endpoint-url "${B2_ENDPOINT}" "${dest}"; then + echo "${rpm_file} already published, skipping build" + skip_build=true fi if [ "${skip_build}" = false ]; then @@ -155,34 +146,29 @@ spec: --define '_smp_mflags -j4' \\ kernel-surface.spec - # kernel-surface-dtb is noarch, so it lands - # in RPMS/noarch rather than RPMS/aarch64; ask - # where each one actually is. - for rpm_name in ${rpm_files}; do - built=$(find "${HOME}/rpmbuild/RPMS" -type f \\ - -name "${rpm_name}" -print -quit) - test -n "${built}" + built="${HOME}/rpmbuild/RPMS/aarch64/${rpm_file}" + test -f "${built}" - aws s3 cp --endpoint-url "${B2_ENDPOINT}" \\ - "${built}" "${prefix}/${rpm_name}" - done + aws s3 cp --endpoint-url "${B2_ENDPOINT}" \\ + "${built}" "${dest}" fi + repo_url="s3://${RPM_BUCKET}/fedora/${fedora_version}/aarch64" repo="${WORKSPACE}/repo" mkdir -p "${repo}" aws s3 sync --endpoint-url "${B2_ENDPOINT}" \\ --exclude '*' --include '*.rpm' \\ - "${prefix}/" "${repo}/" + "${repo_url}/" "${repo}/" createrepo_c --update "${repo}" aws s3 sync --endpoint-url "${B2_ENDPOINT}" \\ --exclude 'repomd.xml*' \\ - "${repo}/repodata/" "${prefix}/repodata/" + "${repo}/repodata/" "${repo_url}/repodata/" aws s3 cp --endpoint-url "${B2_ENDPOINT}" \\ "${repo}/repodata/repomd.xml" \\ - "${prefix}/repodata/repomd.xml" + "${repo_url}/repodata/repomd.xml" # Served next to the repository so that consumers # can `dnf config-manager --add-repo` the URL. |