-
Notifications
You must be signed in to change notification settings - Fork 192
Created automation for Packages.Microsoft publishing #431
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
Conversation
| # Download latest stable deb and rpm packages | ||
| WORKDIR /root | ||
| RUN wget https://mssqlcli.blob.core.windows.net/daily/deb/mssql-cli-dev-latest.deb | ||
| RUN wget https://mssqlcli.blob.core.windows.net/daily/rpm/mssql-cli-dev-latest.rpm |
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.
Let's move away from the 'latest' package and use explicit version numbers. This issue is, a later build might have overwritten the latest and we would know. If we reference the explicit version, this is less likely to happen.
| @@ -0,0 +1,280 @@ | |||
| [ | |||
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.
Is this coming from a package? If so, can we just download package and avoid checking this is? My concern is these values can change.
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.
These values won't change—they map to repos in Packages.Microsoft. If you query the Repo CLI you can get this information.
The key bit of data is the repository ID, which needs to be in the root config when uploading a package. Without some sort of automation, you'd need to look up the repository ID for each Linux repo you're uploading to, and edit the root config manually.
| @@ -0,0 +1,126 @@ | |||
|
|
|||
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.
same deal here - do we have to check this in?
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.
See my comment above. We'd need to store this data somewhere for automation to work. There isn't sensitive data so I thought a JSON would be ok.
As an alternative solution, we could store these values in a database.
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.
remove json, keep urls and add to script
c88eff9 to
6ec21e7
Compare
|
|
||
| local_repo=$1 | ||
| config_file=/root/.repoclient/config.json | ||
| deb_pkg=/root/mssql-cli-dev-latest.deb |
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.
remove dev-latest
| # with config updated, publish deb or rpm package | ||
| if [ $repo_type == "apt" ]; then | ||
| echo "Publishing .deb for $repo_url..." | ||
| repoclient package add $deb_pkg |
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.
add to list of commands in readme
80f09e1 to
89292a7
Compare
pensivebrian
left a comment
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.
I'm wondering if this script should generate a .sh with all reproclient add commands. Then, one would launch the .sh. This way, one can review up front what commands will be run, and then decide them individually, are just run the script.
| # specificies destination testing repos for publishing | ||
| repo_url_testing=( \ | ||
| "microsoft-ubuntu-trusty-prod" \ | ||
| "microsoft-ubuntu-xenial-prod" \ |
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.
aren't some of these prod? I see some of these exists in both lists.
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.
Nope—the URL naming is unfortunately confusing and inconsistent at times.
In some cases, the URL name is the same for both the prod and testing distribution. However, repo ID's are always unique, and we query for the desired repo ID by filtering for URL name and distribution type (i.e. prod or testing).
| # -r specifies the destination repository (by ID) | ||
| if [ $repo_type == "apt" ]; then | ||
| echo "Publishing .deb for $repo_url..." | ||
| repoclient package add $deb_pkg -r $repo_id |
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.
what if there is an error? If there is an error, I think we should abort.
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.
Great minds think alike!!! I had problems terminating the script during this step so I just made a change :)
| @@ -0,0 +1,31 @@ | |||
| FROM amd64/ubuntu:18.04 AS builder | |||
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.
You can mentioned there are issues with this. Does this work out of the box?
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.
The only issue I remember bringing up was the requirement for using amd64 to install the Repo Client. So with Docker, this should work out of the box.
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.
I thought you mention stdio was involved for a license agreement or something.
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.
Oh, yes, STDIO is required for responding to a prompt with the repo client installer. That's why the repo client installation is out of the dockerfile's scope—instead, the dockerfile completes requirements needed for repo client installation.
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.
I see. Can we have a similar script for those who don't use docker?
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.
If you don't use Docker, then it's just a matter of building a Linux machine that can install the repo client. If that's done, then the only remaining steps are:
- Install Repo Client
- Call the publish.sh file
No other scripts are needed.
| ```sh | ||
| release_scripts/Packages.Microsoft/publish.sh $(pwd) 'prod' | ||
| ``` | ||
|
|
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.
We should add a note about what todo if there is an error or need to refresh the binaries with a new version. Can we just re-run the tool with the same package versions?
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.
Do you mean package versions of mssql-cli? Yes.
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.
ops, wrong thread. Cool, we should doc this since many repo's (nuget, pypi) don't support this (or didn't in the recent past)
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.
Let me run this back with the Repo Client team to confirm.
| @@ -0,0 +1,100 @@ | |||
| # Publishes deb and rpm packages to Packages.Microsoft repo | |||
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.
I'm curious why we didn't do this in python?
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.
In hindsight... we could have. Pros and cons here. I thought the bash script would have been more elegant because I pictured fewer complications than our result.
What's nice here is you don't need any Python, it works in any container with bash so this script can theoretically be used in any Linux container (using arm). But Python would have been a cleaner looking script.
7a226dc to
69ae0d7
Compare
In the spirt of our deb and rpm packaging, I have created a Dockerized approach to automate* the publishing of deb and rpm packages to the Packages.Microsoft repository. Automation is needed to support the very long list of Linux distributions we've previously supported. A future PR will provide improved testing for our supported Linux distributions.
* The Repo CLI used to publish packages requires manual installation. This solution is not perfectly automated due to this complexity. Therefore, a step-by-step guide is provided.
Details of this PR:
publish.shexecution. Each entity represents a Linux distribution where we've previously published mssql-cli, or its future versions we've yet to support.publish.shscript.