Skip to content

CLOUDP-59015: Upload rpm to mongo yum repo #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 9, 2020
Merged
213 changes: 196 additions & 17 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ functions:
WORKDIR: ${workdir}
<<: *go_options
command: make build
"set up notary client credentials":
- command: shell.exec
params:
working_dir: mongocli
silent: true
script: |
set -o errexit
cat <<EOF > notary_env.sh
export NOTARY_TOKEN=${signing_auth_token}
export BARQUE_USERNAME=${barque_user}
export BARQUE_PASSWORD=${barque_password}
EOF

echo "${signing_auth_token}" > signing_auth_token
"gen-notices":
- command: shell.exec
type: setup
Expand Down Expand Up @@ -78,6 +64,84 @@ functions:
env:
<<: *go_options
command: make package
"set up remote credentials":
command: shell.exec
params:
silent: true
script: |
set -o errexit
# Since the macros 'private_key_remote' and 'private_key_file' are not always defined
# we default to /dev/null to avoid syntax errors of an empty expansion.
if [ ! -z "${private_key_remote}" ] && [ ! -z "${private_key_file}" ] ; then
mkdir -p ~/.ssh
echo -n "${private_key_remote}" > ${private_key_file|/dev/null}
chmod 0600 ${private_key_file|/dev/null}
fi
# Ensure a clean aws configuration state
rm -rf ~/.aws
mkdir -p ~/.aws
# If ${aws_profile_remote} is not specified then the config & credentials are
# stored in the 'default' profile.
aws_profile="${aws_profile_remote|default}"
# The profile in the config file is specified as [profile <profile>], except
# for [default], see http://boto3.readthedocs.io/en/latest/guide/configuration.html
if [ $aws_profile = "default" ] ; then
aws_profile_config="[default]"
else
aws_profile_config="[profile $aws_profile]"
fi
cat <<EOF >> ~/.aws/config
$aws_profile_config
region = us-east-1
EOF
# The profile in the credentials file is specified as [<profile>].
cat <<EOF >> ~/.aws/credentials
[$aws_profile]
aws_access_key_id = ${aws_key_remote}
aws_secret_access_key = ${aws_secret_remote}
EOF
"set up notary client credentials":
- command: shell.exec
params:
working_dir: mongocli
silent: true
script: |
set -o errexit

cat <<EOF > notary_env.sh
export NOTARY_TOKEN=${signing_auth_token_44}
export BARQUE_USERNAME=${barque_user}
export BARQUE_PASSWORD=${barque_password}
EOF

if [[ ! -f signing_auth_token_44 ]]; then
echo "${signing_auth_token_44}" > signing_auth_token
fi
"push":
- command: shell.exec
params:
working_dir: mongocli
script: |
. ./notary_env.sh

set -o errexit
set -o verbose

CURATOR_RELEASE=${curator_release|"latest"}
curl -L -O http://boxes.10gen.com/build/curator/curator-dist-rhel70-$CURATOR_RELEASE.tar.gz
tar -zxvf curator-dist-rhel70-$CURATOR_RELEASE.tar.gz

# We get the raw version string (v1.2.3-45-gabcdef) from git
VERSION=$(git describe --abbrev=7 | cut -d "v" -f 2)

./curator repo submit \
--service ${barque_url} \
--config .repo_config.yml \
--distro ${distro} \
--edition ${edition} \
--version $VERSION \
--arch x86_64 \
--packages https://s3.amazonaws.com/mongodb-mongocli-build/${project}/${revision}/dist/mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.rpm
tasks:
- name: compile
commands:
Expand Down Expand Up @@ -105,7 +169,7 @@ tasks:
mv mongocli_next_linux_x86_64.deb mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.deb
mv mongocli_next_linux_x86_64.rpm mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.rpm
mv mongocli_next_linux_x86_64.tar.gz mongocli_next_${revision}_${version_id}_${created_at}_linux_x86_64.tar.gz
mv mongocli_next_macOS_x86_64.tar.gz mongocli_next_${revision}_${version_id}_${created_at}_macOS_x86_64.tar.gz
mv mongocli_next_macos_x86_64.tar.gz mongocli_next_${revision}_${version_id}_${created_at}_macOS_x86_64.tar.gz
mv mongocli_next_windows_i386.zip mongocli_next_${revision}_${version_id}_${created_at}_windows_i386.zip
mv mongocli_next_windows_x86_64.zip mongocli_next_${revision}_${version_id}_${created_at}_windows_x86_64.zip
- command: s3.put
Expand All @@ -121,12 +185,127 @@ tasks:
bucket: mongodb-mongocli-build
permissions: public-read
content_type: ${content_type|application/x-gzip}

# RPM Distros
- name: push_rhel70_enterprise
# This should prevent this task from running in patch builds, where we
# don't want to publish packages.
patchable: false
stepback: false
tags: ["push"]
depends_on:
- name: compile
- name: package
commands:
- func: "clone"
- func: "set up remote credentials"
vars:
aws_key_remote: ${repo_aws_key}
aws_secret_remote: ${repo_aws_secret}
- func: "set up notary client credentials"
- func: "push"
vars:
edition: enterprise
distro: rhel70
- name: push_rhel70_org
# This should prevent this task from running in patch builds, where we
# don't want to publish packages.
patchable: false
stepback: false
tags: ["push"]
depends_on:
- name: package
commands:
- func: "clone"
- func: "set up remote credentials"
vars:
aws_key_remote: ${repo_aws_key}
aws_secret_remote: ${repo_aws_secret}
- func: "set up notary client credentials"
- func: "push"
vars:
edition: org
distro: rhel70
- name: push_rhel80_enterprise
# This should prevent this task from running in patch builds, where we
# don't want to publish packages.
patchable: false
stepback: false
tags: ["push"]
depends_on:
- name: compile
- name: package
commands:
- func: "clone"
- func: "set up remote credentials"
vars:
aws_key_remote: ${repo_aws_key}
aws_secret_remote: ${repo_aws_secret}
- func: "set up notary client credentials"
- func: "push"
vars:
edition: enterprise
distro: rhel80
- name: push_rhel80_org
# This should prevent this task from running in patch builds, where we
# don't want to publish packages.
patchable: false
stepback: false
tags: ["push"]
depends_on:
- name: compile
- name: package
commands:
- func: "clone"
- func: "set up remote credentials"
vars:
aws_key_remote: ${repo_aws_key}
aws_secret_remote: ${repo_aws_secret}
- func: "set up notary client credentials"
- func: "push"
vars:
edition: org
distro: rhel80
- name: push_amazon2_enterprise
# This should prevent this task from running in patch builds, where we
# don't want to publish packages.
patchable: false
stepback: false
tags: ["push"]
depends_on:
- name: package
commands:
- func: "clone"
- func: "set up notary client credentials"
- func: "push"
vars:
edition: enterprise
distro: amazon2
- name: push_amazon2_org
# This should prevent this task from running in patch builds, where we
# don't want to publish packages.
patchable: false
stepback: false
tags: ["push"]
depends_on:
- name: compile
- name: package
commands:
- func: "clone"
- func: "set up remote credentials"
vars:
aws_key_remote: ${repo_aws_key}
aws_secret_remote: ${repo_aws_secret}
- func: "set up notary client credentials"
- func: "push"
vars:
edition: org
distro: amazon2
buildvariants:
- name: publish
display_name: Building & Publishing
display_name: "Packaging & Publishing"
run_on:
- rhel70-small
tasks:
- name: compile
- name: package
- name: .push
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ builds:
goarch: 386
archives:
- replacements:
darwin: macOS
darwin: macos
386: i386
amd64: x86_64
format_overrides:
Expand Down
Loading