Skip to content

Commit

Permalink
CDRIVER-5497 implement downstream RPM spec check (#1551)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Albertson <[email protected]>
  • Loading branch information
rcsanchez97 and kevinAlbs committed Mar 5, 2024
1 parent 563ffb5 commit 373e6ba
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .evergreen/generated_configs/legacy-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,15 @@ tasks:
content_type: ${content_type|application/x-gzip}
- name: rpm-package-build
commands:
- command: shell.exec
type: test
params:
working_dir: mongoc
shell: bash
script: |-
set -o errexit
export IS_PATCH="${is_patch}"
sh .evergreen/scripts/check_rpm_spec.sh
- command: shell.exec
type: test
params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def __init__(
NamedTask(
"rpm-package-build",
commands=[
shell_mongoc('export IS_PATCH="${is_patch}"\n' "sh .evergreen/scripts/check_rpm_spec.sh"),
shell_mongoc("sh .evergreen/scripts/build_snapshot_rpm.sh"),
s3_put(
local_file="rpm.tar.gz",
Expand Down
43 changes: 43 additions & 0 deletions .evergreen/scripts/check_rpm_spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

#
# Copyright 2024 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -o errexit

#
# check_rpm_spec.sh - Check if our RPM spec matches downstream's
#
# Supported/used environment variables:
# IS_PATCH If "true", this is an Evergreen patch build.


on_exit () {
if [ -n "${SPEC_FILE}" ]; then
rm -f "${SPEC_FILE}"
fi
}
trap on_exit EXIT

if [ "${IS_PATCH}" = "true" ]; then
echo "This is a patch build...skipping RPM spec check"
exit
fi

SPEC_FILE=$(mktemp --tmpdir -u mongo-c-driver.XXXXXXXX.spec)
curl --retry 5 https://src.fedoraproject.org/rpms/mongo-c-driver/raw/rawhide/f/mongo-c-driver.spec -sS --max-time 120 --fail --output "${SPEC_FILE}"

diff -q .evergreen/etc/mongo-c-driver.spec "${SPEC_FILE}" || (echo "Synchronize RPM spec from downstream to fix this failure. See instructions here: https://docs.google.com/document/d/1ItyBC7VN383zNXu3oUOQJYR7adfYI8ECjLMJ5kqA9X8/edit#heading=h.ahdrr3b5xv3"; exit 1)

0 comments on commit 373e6ba

Please sign in to comment.