Automatically generate changelogs in docker builds

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-05-18 13:55:05 +02:00
parent 033b2fd90d
commit e5125515f0
6 changed files with 19 additions and 6 deletions

View File

@ -27,6 +27,7 @@ ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# packaging # packaging
ARG PKG_NAME
ARG PKG_VERS ARG PKG_VERS
ARG PKG_REV ARG PKG_REV
@ -63,6 +64,7 @@ COPY packaging/rpm .
CMD arch=$(uname -m) && \ CMD arch=$(uname -m) && \
rpmbuild --clean --target=$arch -bb \ rpmbuild --clean --target=$arch -bb \
-D "_topdir $PWD" \ -D "_topdir $PWD" \
-D "release_date $(date +'%a %b %d %Y')" \
-D "version $VERSION" \ -D "version $VERSION" \
-D "libnvidia_container_version ${VERSION}-${RELEASE}" \ -D "libnvidia_container_version ${VERSION}-${RELEASE}" \
-D "release $RELEASE" \ -D "release $RELEASE" \

View File

@ -27,6 +27,7 @@ ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# packaging # packaging
ARG PKG_NAME
ARG PKG_VERS ARG PKG_VERS
ARG PKG_REV ARG PKG_REV
@ -61,6 +62,7 @@ COPY packaging/rpm .
CMD arch=$(uname -m) && \ CMD arch=$(uname -m) && \
rpmbuild --clean --target=$arch -bb \ rpmbuild --clean --target=$arch -bb \
-D "_topdir $PWD" \ -D "_topdir $PWD" \
-D "release_date $(date +'%a %b %d %Y')" \
-D "version $VERSION" \ -D "version $VERSION" \
-D "libnvidia_container_version ${VERSION}-${RELEASE}" \ -D "libnvidia_container_version ${VERSION}-${RELEASE}" \
-D "release $RELEASE" \ -D "release $RELEASE" \

View File

@ -32,6 +32,7 @@ ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# packaging # packaging
ARG PKG_NAME
ARG PKG_VERS ARG PKG_VERS
ARG PKG_REV ARG PKG_REV
@ -64,9 +65,11 @@ RUN if [ "$(lsb_release -cs)" = "jessie" ]; then \
WORKDIR $DIST_DIR WORKDIR $DIST_DIR
COPY packaging/debian ./debian COPY packaging/debian ./debian
RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \ RUN dch --create --package="${PKG_NAME}" \
dch --changelog debian/changelog --append "Bump libnvidia-container dependency to ${REVISION}}" && \ --newversion "${REVISION}" \
dch --changelog debian/changelog -r "" && \ "See https://gitlab.com/nvidia/container-toolkit/container-toolkit/-/blob/main/CHANGELOG.md for the changelog" && \
dch --append "Bump libnvidia-container dependency to ${REVISION}" && \
dch -r "" && \
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi
CMD export DISTRIB="$(lsb_release -cs)" && \ CMD export DISTRIB="$(lsb_release -cs)" && \

View File

@ -25,6 +25,7 @@ ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# packaging # packaging
ARG PKG_NAME
ARG PKG_VERS ARG PKG_VERS
ARG PKG_REV ARG PKG_REV
@ -59,6 +60,7 @@ COPY packaging/rpm .
CMD arch=$(uname -m) && \ CMD arch=$(uname -m) && \
rpmbuild --clean --target=$arch -bb \ rpmbuild --clean --target=$arch -bb \
-D "_topdir $PWD" \ -D "_topdir $PWD" \
-D "release_date $(date +'%a %b %d %Y')" \
-D "version $VERSION" \ -D "version $VERSION" \
-D "libnvidia_container_version ${VERSION}-${RELEASE}" \ -D "libnvidia_container_version ${VERSION}-${RELEASE}" \
-D "release $RELEASE" \ -D "release $RELEASE" \

View File

@ -30,6 +30,7 @@ ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# packaging # packaging
ARG PKG_NAME
ARG PKG_VERS ARG PKG_VERS
ARG PKG_REV ARG PKG_REV
@ -57,9 +58,11 @@ COPY config/config.toml.${CONFIG_TOML_SUFFIX} $DIST_DIR/config.toml
WORKDIR $DIST_DIR WORKDIR $DIST_DIR
COPY packaging/debian ./debian COPY packaging/debian ./debian
RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \ RUN dch --create --package="${PKG_NAME}" \
dch --changelog debian/changelog --append "Bump libnvidia-container dependency to ${REVISION}}" && \ --newversion "${REVISION}" \
dch --changelog debian/changelog -r "" && \ "See https://gitlab.com/nvidia/container-toolkit/container-toolkit/-/blob/main/CHANGELOG.md for the changelog" && \
dch --append "Bump libnvidia-container dependency to ${REVISION}" && \
dch -r "" && \
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi
CMD export DISTRIB="$(lsb_release -cs)" && \ CMD export DISTRIB="$(lsb_release -cs)" && \

View File

@ -128,6 +128,7 @@ docker-build-%:
--progress=plain \ --progress=plain \
--build-arg BASEIMAGE="$(BASEIMAGE)" \ --build-arg BASEIMAGE="$(BASEIMAGE)" \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \ --build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg PKG_NAME="$(LIB_NAME)" \
--build-arg PKG_VERS="$(LIB_VERSION)" \ --build-arg PKG_VERS="$(LIB_VERSION)" \
--build-arg PKG_REV="$(PKG_REV)" \ --build-arg PKG_REV="$(PKG_REV)" \
--build-arg CONFIG_TOML_SUFFIX="$(CONFIG_TOML_SUFFIX)" \ --build-arg CONFIG_TOML_SUFFIX="$(CONFIG_TOML_SUFFIX)" \