Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ def build():
utility.ROOT_DIR,
continue_on_error=False)

# checks if long description will render correctly
utility.exec_command('twine check {}'
.format(os.path.join(utility.MSSQLCLI_DIST_DIRECTORY, '*')),
utility.ROOT_DIR, continue_on_error=False)
try:
# checks if long description will render correctly--does not work on some systems
utility.exec_command('twine check {}'
.format(os.path.join(utility.MSSQLCLI_DIST_DIRECTORY, '*')),
utility.ROOT_DIR, continue_on_error=False)
except IOError as err:
print(err)
print("Unable to run 'twine check'.")
Comment thread
pensivebrian marked this conversation as resolved.

# Copy back the SqlToolsService binaries for this platform.
clean_and_copy_sqltoolsservice(utility.get_current_platform())
Expand Down
13 changes: 7 additions & 6 deletions build_scripts/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ RUN apt-get -y install python3-all python3-pip python3-setuptools nano git sudo
RUN python3 -m pip install --upgrade pip

# Build .deb
RUN mkdir Repos
RUN mkdir Repos/mssql-cli
ADD . Repos/mssql-cli
WORKDIR Repos/mssql-cli
RUN mkdir /Repos
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're hardcoding and assuming a /Repos/mssql-cli? Seems fine for docker, but we can't make this assumption for dev boxes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, I've accounted for this.

RUN mkdir /Repos/mssql-cli
ADD . /Repos/mssql-cli
WORKDIR /Repos/mssql-cli
RUN build_scripts/debian/build.sh $(pwd)

# Build dependencies to support publishing release of .deb
RUN python3 -m pip install -r requirements-dev.txt
# Copy deb to root where DevOps copies package
WORKDIR /
RUN cp /Repos/debian_output/mssql-cli-dev-latest.deb .
18 changes: 13 additions & 5 deletions build_scripts/debian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Build with Docker
From the root repo directory, run:
```
```sh
docker build \
--build-arg AZURE_STORAGE_CONNECTION_STRING=${AZURE_STORAGE_CONNECTION_STRING} \
--build-arg MSSQL_CLI_OFFICIAL_BUILD=${MSSQL_CLI_OFFICIAL_BUILD} \
Expand All @@ -13,17 +13,25 @@ docker build \
```

### Release .deb to Daily Storage with Docker
After the docker container is built, call:
> Note: it is recommended to publish packages using Azure DevOps pipelines.

Run the the docker container after it is built:
```sh
docker run -it mssqlcli-ubuntu16-build bash
```
docker run mssqlcli-ubuntu16-build python3 release.py publish_daily_deb

Inside the console, complete the following calls:
```sh
python3 -m pip install -r requirements-dev.txt
python3 release.py publish_daily_deb
```

### Build Debian Package without Docker

On a build machine (e.g. new Ubuntu 14.04 VM), run the build script.

For example:
```
```sh
git clone https://github.com/dbcli/mssql-cli
cd mssql-cli
build_scripts/debian/build.sh $(pwd)
Expand All @@ -37,7 +45,7 @@ Now you have built the package, upload the package to the apt repository.
## Verification

CLI_VERSION can be found in *build_scripts/debian/build.sh*
```
```sh
sudo dpkg -i mssql-cli_0.10.0.dev-1_all.deb
mssql-cli --version
mssql-cli -h
Expand Down
15 changes: 8 additions & 7 deletions build_scripts/rpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:8
FROM centos:7

ARG AZURE_STORAGE_CONNECTION_STRING
ARG MSSQL_CLI_OFFICIAL_BUILD
Expand All @@ -16,11 +16,12 @@ RUN yum install -y git sudo wget python3
RUN python3 -m pip install --upgrade pip

# Build .rpm
RUN mkdir Repos
RUN mkdir Repos/mssql-cli
ADD . Repos/mssql-cli
WORKDIR Repos/mssql-cli
RUN mkdir /Repos
RUN mkdir /Repos/mssql-cli
ADD . /Repos/mssql-cli
WORKDIR /Repos/mssql-cli
RUN build_scripts/rpm/build.sh $(pwd)

# Build dependencies for eventual release
RUN python3 -m pip install -r requirements-dev.txt
# Copy rpm to root where DevOps copies package
WORKDIR /
RUN cp /Repos/rpm_output/mssql-cli-dev-latest.rpm .
26 changes: 17 additions & 9 deletions build_scripts/rpm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Building with Docker
From the root repo directory, run:
```
```sh
docker build \
--build-arg AZURE_STORAGE_CONNECTION_STRING=${AZURE_STORAGE_CONNECTION_STRING} \
--build-arg MSSQL_CLI_OFFICIAL_BUILD=${MSSQL_CLI_OFFICIAL_BUILD} \
Expand All @@ -13,49 +13,57 @@ docker build \
```

### Release RPM Package to Daily Storage with Docker
After the docker container is built, call:
> Note: it is recommended to publish packages using Azure DevOps pipelines.

Run the the docker container after it is built:
```sh
docker run -it mssqlcli-rpm-build bash
```
docker run mssqlcli-rpm-build python3 release.py publish_daily_rpm

Inside the console, complete the following calls:
```sh
python3 -m pip install -r requirements-dev.txt
python3 release.py publish_daily_rpm
```

### Building without Docker
On a build machine (e.g. new CentOS 7 VM) run the following.

Install dependencies required to build:
Required for rpm build tools & required to build mssql-cli.
```
```sh
sudo yum install -y gcc git rpm-build rpm-devel rpmlint make bash coreutils diffutils patch rpmdevtools python libffi-devel python-devel openssl-devel
```

Build example:
Note: use the full path to the repo path, not a relative path.
```
```sh
git clone https://github.com/dbcli/mssql-cli
cd mssql-cli
build_scripts/rpm/build.sh $(pwd)
```

## Verification

```
```sh
sudo yum install -y epel-release
sudo yum install -y libunwind libicu
sudo rpm -i /root/rpmbuild/RPMS/x86_64/mssql-cli*.rpm
mssql-cli --version
```

Check the file permissions of the package:
```
```sh
rpmlint /root/rpmbuild/RPMS/x86_64/mssql-cli*.rpm
```

Check the file permissions of the package:
```
```sh
rpm -qlvp /root/rpmbuild/RPMS/x86_64/mssql-cli*.rpm
```

To remove:
```
```sh
sudo rpm -e mssql-cli
```

Expand Down