build: upload release and nightly CHANGELOG.md (#23527)

pull/23542/head
Brandon Pfeifer 2022-07-12 20:58:35 -04:00 committed by GitHub
parent 4da4d03fe2
commit 4b2949a67a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 57 deletions

View File

@ -134,7 +134,9 @@ workflows:
<<: *nofork_filter <<: *nofork_filter
requires: requires:
- build-package-linux-amd64 - build-package-linux-amd64
- publish-packages-s3: - changelog:
<<: *any_filter
- s3-publish-packages:
<<: *release_filter <<: *release_filter
requires: requires:
- test-linux-packages - test-linux-packages
@ -142,6 +144,11 @@ workflows:
- build-package-linux-amd64 - build-package-linux-amd64
- build-package-linux-arm64 - build-package-linux-arm64
- build-package-windows-amd64 - build-package-windows-amd64
- s3-publish-changelog:
<<: *release_filter
publish-type: release
requires:
- changelog
- perf-test: - perf-test:
record_results: true record_results: true
requires: requires:
@ -197,7 +204,8 @@ workflows:
- master - master
jobs: jobs:
- changelog - changelog
- publish-changelog-s3: - s3-publish-changelog:
publish-type: nightly
requires: requires:
- changelog - changelog
- test-race - test-race
@ -399,7 +407,13 @@ jobs:
steps: steps:
- checkout - checkout
- run: - run:
name: Get InfluxDB version name: Install Package Dependencies
command: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --yes git
- run:
name: Get InfluxDB Version
command: | command: |
PREFIX=2.x .circleci/scripts/get-version PREFIX=2.x .circleci/scripts/get-version
- run: - run:
@ -450,12 +464,13 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install --yes \ sudo apt-get install --yes \
build-essential \ build-essential \
git \
rpm \ rpm \
ruby-dev ruby-dev
gem install fpm gem install fpm
- run: - run:
name: Get Package Versions name: Get InfluxDB Version
command: | command: |
PREFIX=2.x .circleci/scripts/get-version PREFIX=2.x .circleci/scripts/get-version
- run: - run:
@ -472,39 +487,65 @@ jobs:
path: /artifacts path: /artifacts
destination: artifacts destination: artifacts
publish-packages-s3: s3-publish-packages:
docker: docker:
# `cimg/python` may seem incorrect, but apparently it includes `curl` - image: ubuntu:latest
# which is required for `aws-s3/sync` to work. This image is also
# suggested by the orb's documentation:
# https://circleci.com/developer/orbs/orb/circleci/aws-s3#usage-examples
- image: cimg/python:3.6
steps: steps:
- attach_workspace: - attach_workspace:
at: /tmp/workspace at: /tmp/workspace
- aws-s3/sync: - checkout
arguments: | - run:
--acl public-read name: Publish Packages to S3
aws-region: RELEASE_AWS_REGION command: |
aws-access-key-id: RELEASE_AWS_ACCESS_KEY_ID export DEBIAN_FRONTEND=noninteractive
aws-secret-access-key: RELEASE_AWS_SECRET_ACCESS_KEY apt-get update
from: /tmp/workspace/artifacts apt-get install --yes awscli git
to: s3://dl.influxdata.com/influxdb/releases
publish-changelog-s3: PREFIX=2.x .circleci/scripts/get-version
source "${BASH_ENV}"
# required for sha256sum generate the correct paths
pushd /tmp/workspace/artifacts
# Since the artifacts are generated in parallel, the checksums
# cannot be calculated until all artifacts are complete. This
# excludes `CHANGELOG.md`. Historically, `CHANGELOG.md` was
# not included in the checksums.
sha256sum * | tee influxdb.${VERSION}.sha256
aws s3 sync . 's3://dl.influxdata.com/influxdb/releases'
s3-publish-changelog:
parameters:
publish-type:
type: string
docker: docker:
- image: cimg/python:3.6 - image: ubuntu:latest
steps: steps:
- attach_workspace: - attach_workspace:
at: /tmp/workspace at: /tmp/workspace
- aws-s3/sync: - checkout
arguments: | - run:
--acl public-read name: Publish Changelog to S3
aws-region: RELEASE_AWS_REGION command: |
aws-access-key-id: RELEASE_AWS_ACCESS_KEY_ID export DEBIAN_FRONTEND=noninteractive
aws-secret-access-key: RELEASE_AWS_SECRET_ACCESS_KEY apt-get update
from: /tmp/workspace/changelog_artifacts/ apt-get install --yes awscli git
to: s3://dl.influxdata.com/platform/nightlies/master
PREFIX=2.x .circleci/scripts/get-version
source "${BASH_ENV}"
pushd /tmp/workspace/changelog_artifacts
case "<< parameters.publish-type >>"
in
release)
aws s3 cp CHANGELOG.md "s3://dl.influxdata.com/influxdb/releases/CHANGELOG.${VERSION}.md"
;;
nightly)
aws s3 cp CHANGELOG.md "s3://dl.influxdata.com/platform/nightlies/<< pipeline.git.branch >>/CHANGELOG.md"
;;
esac
build-docker-nightly: build-docker-nightly:
parameters: parameters:
@ -803,41 +844,21 @@ jobs:
changelog: changelog:
docker: docker:
- image: quay.io/influxdb/changelogger:903e73f266155f9bcd78356ea7fdb051b6db74b3 - image: quay.io/influxdb/changelogger:d7093c409adedd8837ef51fa84be0d0f8319177a
steps: steps:
- checkout - checkout
- run: - run:
name: Generate changelog name: Generate changelog
command: | command: |
BRANCH="<< pipeline.git.branch >>" PREFIX=2.x .circleci/scripts/get-version
VERSION="v$BRANCH" source "${BASH_ENV}"
DOCS_LINKS_VERSION="$VERSION"
# Runs triggered by pushed tags do not have the pipeline.git.branch parameter available. if [[ "${RELEASE:-}" ]]
if [ -n "<< pipeline.git.tag >>" ]; then then
VERSION="<< pipeline.git.tag >>" export DESCRIPTION="In addition to the list of changes below, please also see the [official release notes](https://docs.influxdata.com/influxdb/${VERSION}/reference/release-notes/influxdb/) for other important information about this release."
DOCS_LINKS_VERSION="$(echo "$VERSION" | sed 's/\.[^.]*$//')"
BRANCH="$(echo "$DOCS_LINKS_VERSION" | sed 's/v//' )"
fi fi
mkdir changelog_artifacts PRODUCT="OSS" changelogger
echo -e "CHANGELOG for InfluxDB OSS $VERSION commit ${CIRCLE_SHA1}\n" > changelog_artifacts/CHANGELOG.md
if [[ ! "$BRANCH" == "master" ]] ; then
echo -e "In addition to the list of changes below, please also see the [official release notes](https://docs.influxdata.com/influxdb/$DOCS_LINKS_VERSION/reference/release-notes/influxdb/) for other important information about this release.\n" >> changelog_artifacts/CHANGELOG.md
fi
if [[ "$BRANCH" == "master" ]] ; then
LATEST_21X="$(git tag | grep '^v2\.1\.[0-9]*$' | sort -V | tail -1)"
# build 2.1.0 to 2.1.x changelog, plus unreleased from master
build-multibranch-changelog.sh HEAD "$LATEST_21X" v2.1.0 >> changelog_artifacts/CHANGELOG.md
elif [[ "$BRANCH" == "2.1" ]] ; then
# build 2.1.0 to current 2.1 changelog
build-simple-changelog.sh HEAD v2.1.0 >> changelog_artifacts/CHANGELOG.md
fi
cat ./scripts/ci/CHANGELOG_frozen.md >> changelog_artifacts/CHANGELOG.md
- store_artifacts: - store_artifacts:
path: changelog_artifacts/ path: changelog_artifacts/
- persist_to_workspace: - persist_to_workspace:

View File

@ -3,7 +3,7 @@ set -o nounset \
-o errexit \ -o errexit \
-o pipefail -o pipefail
REGEX_TAG='v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' REGEX_TAG='v([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)'
function semver_tags() function semver_tags()
{ {
@ -28,15 +28,21 @@ TAG=$(head -n 1 <<<"$(semver_tags)")
# is being built from an unversioned branch. In which case, this will # is being built from an unversioned branch. In which case, this will
# construct a version that is compatible with Debian versioning: # construct a version that is compatible with Debian versioning:
# ${PREFIX}-<< short commit hash >> # ${PREFIX}-<< short commit hash >>
if [[ ${TAG:-} ]] if [[ ${TAG} =~ ^${REGEX_TAG}$ ]]
then then
cat <<EOF >>"${BASH_ENV}" cat <<EOF >>"${BASH_ENV}"
export VERSION="${TAG:1}" export VERSION="${TAG:1}"
export MAJOR=${BASH_REMATCH[1]}
export MINOR=${BASH_REMATCH[2]}
export PATCH=${BASH_REMATCH[3]}
export RELEASE=1 export RELEASE=1
EOF EOF
else else
cat <<EOF >>"${BASH_ENV}" cat <<EOF >>"${BASH_ENV}"
export VERSION="${PREFIX}-$(git rev-parse --short HEAD)" export VERSION="${PREFIX}-$(git rev-parse --short HEAD)"
export MAJOR=
export MINOR=
export PATCH=
export RELEASE= export RELEASE=
EOF EOF
fi fi