-
Notifications
You must be signed in to change notification settings - Fork 75
Docker release package #61
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#------------------------------------------------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
#------------------------------------------------------------------------------ | ||
|
||
# Example: | ||
# docker run --rm microsoft/sqlcmd sqlcmd --help | ||
# | ||
|
||
FROM scratch | ||
ARG BUILD_DATE | ||
ARG PACKAGE_VERSION | ||
|
||
LABEL maintainer="Microsoft" \ | ||
org.label-schema.schema-version="1.0" \ | ||
org.label-schema.vendor="Microsoft" \ | ||
org.label-schema.name="SQLCMD CLI" \ | ||
org.label-schema.version=$PACKAGE_VERSION \ | ||
org.label-schema.license="https://github.com/microsoft/go-sqlcmd/blob/main/LICENSE" \ | ||
org.label-schema.description="The MSSQL SQLCMD CLI tool" \ | ||
org.label-schema.url="https://github.com/microsoft/go-sqlcmd" \ | ||
org.label-schema.usage="https://docs.microsoft.com/sql/tools/sqlcmd-utility" \ | ||
org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.docker.cmd="docker run -it microsoft/sqlcmd:$PACKAGE_VERSION" | ||
|
||
|
||
COPY ./sqlcmd /usr/bin/sqlcmd | ||
|
||
CMD ["sqlcmd"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Docker Release | ||
|
||
## Building Docker in CI/CD pipeline | ||
|
||
Execute the following command from the root directory of this repository: | ||
|
||
```bash | ||
./release/linux/docker/pipeline.sh | ||
``` | ||
|
||
Output will be sent to `./output/docker` | ||
|
||
## Verify | ||
|
||
```bash | ||
./release/linux/docker/pipeline-test.sh | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
#------------------------------------------------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
#------------------------------------------------------------------------------ | ||
|
||
# Description: | ||
# | ||
# Instructions to be invoked under the build CI pipeline in AzureDevOps. | ||
# | ||
# Kickoff docker image test: | ||
# | ||
# Usage: | ||
# | ||
# $ pipeline-test.sh | ||
|
||
set -exv | ||
|
||
: "${REPO_ROOT_DIR:=`cd $(dirname $0); cd ../../../; pwd`}" | ||
|
||
PACKAGE_VERSION=${CLI_VERSION:=0.0.1} | ||
PACKAGE_VERSION_REVISION=${CLI_VERSION_REVISION:=1} | ||
|
||
BUILD_ARTIFACTSTAGINGDIRECTORY=${BUILD_ARTIFACTSTAGINGDIRECTORY:=${REPO_ROOT_DIR}/output/docker} | ||
IMAGE_NAME=microsoft/sqlcmd${BUILD_BUILDNUMBER:=''}:latest | ||
TAR_FILE=${BUILD_ARTIFACTSTAGINGDIRECTORY}/sqlcmd-docker-${PACKAGE_VERSION}-${PACKAGE_VERSION_REVISION}.tar | ||
|
||
echo "==========================================================" | ||
echo "PACKAGE_VERSION: ${PACKAGE_VERSION}" | ||
echo "PACKAGE_VERSION_REVISION: ${PACKAGE_VERSION_REVISION}" | ||
echo "BUILD_ARTIFACTSTAGINGDIRECTORY: ${BUILD_ARTIFACTSTAGINGDIRECTORY}" | ||
echo "Image name: ${IMAGE_NAME}" | ||
echo "Docker image file: ${TAR_FILE}" | ||
echo "==========================================================" | ||
|
||
docker load < ${TAR_FILE} | ||
docker run ${IMAGE_NAME} sqlcmd --help || exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
#------------------------------------------------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
#------------------------------------------------------------------------------ | ||
|
||
# Description: | ||
# | ||
# Instructions to be invoked under the build CI pipeline in AzureDevOps. | ||
# | ||
# Build and save the `sqlcmd` image into the bundle: | ||
# `sqlcmd-docker-${PACKAGE_VERSION}.tar` | ||
# | ||
# Usage: | ||
# | ||
# export BUILD_NUMBER=12345 (optional - used to identify the IMAGE_NAME) | ||
# $ pipeline.sh | ||
|
||
: "${REPO_ROOT_DIR:=`cd $(dirname $0); cd ../../../; pwd`}" | ||
DIST_DIR=${BUILD_STAGINGDIRECTORY:=${REPO_ROOT_DIR}/output/docker} | ||
IMAGE_NAME=microsoft/sqlcmd${BUILD_BUILDNUMBER:=''} | ||
|
||
if [[ "${BUILD_OUTPUT}" != "" ]]; then | ||
cp ${BUILD_OUTPUT}/SqlcmdLinuxAmd64/sqlcmd ${REPO_ROOT_DIR}/sqlcmd | ||
fi | ||
|
||
chmod u+x ${REPO_ROOT_DIR}/sqlcmd | ||
|
||
PACKAGE_VERSION=${CLI_VERSION:=0.0.1} | ||
PACKAGE_VERSION_REVISION=${CLI_VERSION_REVISION:=1} | ||
|
||
echo "==========================================================" | ||
echo "PACKAGE_VERSION: ${PACKAGE_VERSION}" | ||
echo "PACKAGE_VERSION_REVISION: ${PACKAGE_VERSION_REVISION}" | ||
echo "IMAGE_NAME: ${IMAGE_NAME}" | ||
echo "Output location: ${DIST_DIR}" | ||
echo "==========================================================" | ||
|
||
docker build --no-cache \ | ||
--build-arg BUILD_DATE="`date -u +"%Y-%m-%dT%H:%M:%SZ"`" \ | ||
--build-arg PACKAGE_VERSION=${PACKAGE_VERSION} \ | ||
--build-arg PACKAGE_VERSION_REVISION=${PACKAGE_VERSION_REVISION} \ | ||
--tag ${IMAGE_NAME}:latest \ | ||
${REPO_ROOT_DIR} | ||
|
||
echo "==========================================================" | ||
echo "Done - docker build" | ||
echo "==========================================================" | ||
|
||
mkdir -p ${DIST_DIR} || exit 1 | ||
docker save -o "${DIST_DIR}/sqlcmd-docker-${PACKAGE_VERSION}-${PACKAGE_VERSION_REVISION}.tar" ${IMAGE_NAME}:latest | ||
|
||
echo "==========================================================" | ||
echo "Done - docker save" | ||
echo "==========================================================" | ||
|
||
echo "=== Done =================================================" | ||
docker rmi -f ${IMAGE_NAME}:latest | ||
ls ${DIST_DIR} | ||
echo "==========================================================" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code signing is going to vary widely per package type. Perhaps we could move each signing profile into its own yml and include the appropriate yml based on the package type. For a docker package the included yml could have a no-op step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I'm about to run into this with the next PR for Windows .msi.