Skip to content

Commit

Permalink
Add support NuGet.org and ApiKey authentication (#2)
Browse files Browse the repository at this point in the history
Update details for Public packages
  • Loading branch information
spbrogan authored and Bret Barkelew committed Mar 20, 2019
1 parent e31fd73 commit 65e544b
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 11 deletions.
2 changes: 1 addition & 1 deletion BaseTools/Bin/basetools_ext_dep.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"scope": "global-win",
"type": "nuget",
"name": "Basetools-Win32",
"source": "https://pkgs.dev.azure.com/projectmu/_packaging/mu_packages/nuget/v3/index.json",
"source": "https://api.nuget.org/v3/index.json",
"version": "0.27306.1",
"flags": ["set_shell_var", "set_path"],
"var_name": "EDK_TOOLS_PATH"
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Bin/nasm_ext_dep.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"scope": "global-win",
"type": "nuget",
"name": "nasm",
"source": "https://pkgs.dev.azure.com/projectmu/_packaging/mu_packages/nuget/v3/index.json",
"source": "https://api.nuget.org/v3/index.json",
"version": "2.13.03",
"flags": ["set_shell_var"],
"var_name": "NASM_PREFIX"
Expand Down
6 changes: 3 additions & 3 deletions UefiBuild/CoreBuild/iasl_ext_dep.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scope": "corebuild",
"scope": "global-win",
"type": "nuget",
"name": "iasl",
"source": "https://windowspartners.pkgs.visualstudio.com/_packaging/iasl/nuget/v3/index.json",
"version": "20180209",
"source": "https://api.nuget.org/v3/index.json",
"version": "20181003.0.0",
"flags": ["set_path"]
}
9 changes: 9 additions & 0 deletions UefiBuild/NugetPublishing/Mu-Basetools-Win32.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Mu-Basetools-Win32",
"author_string": "ProjectMu, TianoCore",
"server_url": "https://api.nuget.org/v3/index.json",
"project_url": "https://aka.ms/projectmu",
"license_url": "https://github.com/tianocore/edk2/blob/master/License.txt",
"description_string": "Edk2 Basetools compiled for Windows packaged for Project Mu",
"copyright_string": "Copyright 2018"
}
47 changes: 47 additions & 0 deletions UefiBuild/NugetPublishing/Mu-Basetools-Win32.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Mu BaseTools Win32 Notes

This is a set of compiled tools for Edk2 development on Windows. This set has both the standard Edk2 tools as well as additional tools created for Project Mu.

## Where

Information about the TianoCore Edk2 Basetools can be found here:
* https://tianocore.org
* https://github.com/tianocore/edk2
* https://github.com/tianocore/edk2-BaseTools-win32

Information about Project Mu can be found here:
* https://microsoft.github.io/mu/
* https://github.com/Microsoft/mu
* https://github.com/microsoft/mu_basecore

## What

TianoCore/Project Mu Edk2 Build tools

## Version

====== TODO ======



Nuget version is AA.BB.CC

* If the version is a single number then make it the _AA_ field and use zeros for _BB.CC_
* Example: version command is **20160912** then NuGet version is **20160912.0.0**
* If a version has two numbers partitioned by a "-" then make those the _AA.BB_ fields and use zero for the _CC_
* Example: version command is **1234-56** then NuGet version is **1234.56.0**


## Process to publish new version of tool

1. Download desired version from
2. Unzip
3. Make a new folder (for my example I will call it "new")
4. Copy the assets to publish into this new folder
5. Run the <_TOOL_> -v command to see the version.
6. Open cmd prompt in the NugetPublishing dir
7. Pack and push
```cmd
NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath Mu-Basetools-Win32.config.json --Version <nuget version here> --InputFolderPath <path to newly created folder here> --ApiKey <your key here>
```

9 changes: 9 additions & 0 deletions UefiBuild/NugetPublishing/Mu-Nasm.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "mu_nasm",
"author_string": "The NASM development team",
"server_url": "https://api.nuget.org/v3/index.json",
"project_url": "http://nasm.us/",
"license_url": "https://opensource.org/licenses/BSD-2-Clause",
"description_string": "NASM the netwide assembler packaged for Project Mu",
"copyright_string": "Copyright 2018"
}
35 changes: 35 additions & 0 deletions UefiBuild/NugetPublishing/Mu-Nasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Mu-Nasm Notes

This tool is the open source NASM assembler. More information can be found at https://nasm.us/

## Where

Go to https://nasm.us and find the desired download.

## What

nasm.exe is the assembler.

## Version

``` cmd
nasm.exe -v
```
Nuget version is AA.BB.CC

* The version command generally outputs a version in AA.BB.CC format.


## Process to publish new version of tool

1. Download desired version from nasm.us
2. Unzip
3. Make a new folder (for my example I will call it "new")
4. Copy the assets to publish into this new folder (in this case just nasm.exe and ndisasm.exe)
5. Run the nasm.exe -v command to see the version.
6. Open cmd prompt in the NugetPublishing dir
7. Pack and push
```cmd
NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath Mu-Nasm.config.json --Version <nuget version here> --InputFolderPath <path to newly created folder here> --ApiKey <your key here>
```

8 changes: 5 additions & 3 deletions UefiBuild/NugetPublishing/NugetPublishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def Pack(self, version, OutputDirectory, ContentDir, RelNotesText=None):
self.TempFileToDelete.append(self.NuPackageFile)
return ret

def Push(self, nuPackage):
def Push(self, nuPackage, apikey):
if(not os.path.isfile(nuPackage)):
raise Exception("Invalid file path for NuPkg file")
logging.debug("Pushing %s file to server %s" % (nuPackage, self.ConfigData["server_url"]))
Expand All @@ -293,7 +293,7 @@ def Push(self, nuPackage):
cmd += ["-Verbosity", "detailed"]
# cmd += ["-NonInteractive"]
cmd += ["-Source", self.ConfigData["server_url"]]
cmd += ["-ApiKey", "VSTS"]
cmd += ["-ApiKey", apikey]
cmd_string = " ".join(cmd)
ret = RunCmd(cmd_string)

Expand Down Expand Up @@ -335,10 +335,12 @@ def GatherArguments():
parser.add_argument('--ReleaseNotesText', dest="ReleaseNotes", help="<Optional>Release Notes String", required=False)
parser.add_argument('--InputFolderPath', dest="InputFolderPath", help="<Required>Relative or Absolute Path to folder containing content to pack. All content will be added but the folder will not", required=True)
parser.add_argument('--Copyright', dest="Copyright", help="<Optional>Change the Copyright string")
parser.add_argument('--ApiKey', dest="ApiKey", help="<Optional>Api key to use. Default is 'VSTS' which will invoke interactive login", default="VSTS")

elif(args.op.lower() == "push"):
parser.add_argument("--ConfigFilePath", dest="ConfigFilePath", help="<Required>Path to config file", required=True)
parser.add_argument('--PackageFile', dest="PackageFile", help="<Required>Path To Package File", required=True)
parser.add_argument('--ApiKey', dest="ApiKey", help="<Optional>Api key to use. Default is 'VSTS' which will invoke interactive login", default="VSTS")

if(args.op.lower() == "pack"):
parser.add_argument('--OutputFolderPath', dest="OutputFolderPath", help="<Optional>Output folder where nupkg will be saved. Default is cwd", default=os.getcwd())
Expand Down Expand Up @@ -457,7 +459,7 @@ def main():
if(not os.path.isfile(NuPkgFilePath)):
logging.critical("NuPkgFilePath is not valid file. %s" % NuPkgFilePath)
raise Exception("Invalid Pkg File. File doesn't exist")
ret = nu.Push(NuPkgFilePath)
ret = nu.Push(NuPkgFilePath, args.ApiKey)


nu.LogObject()
Expand Down
17 changes: 14 additions & 3 deletions UefiBuild/NugetPublishing/ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# NugetPublishing

Tool to help create and publish nuget package for Project Mu resources
Tool to help create and publish nuget packages for Project Mu resources

## Usage

See NugetPublishing.py -h
See NugetPublishing.py -h


## Authentication

For publishing most service providers require authentication. The **--ApiKey** parameter allows the caller to supply a unique key for authorization. There are numerous ways to authenticate.
For example
* Azure Dev Ops:
* VSTS credential manager. In an interactive session a dialog will popup for the user to login
* Tokens can also be used as the API key. Go to your account page to generate a token that can push packages
* NuGet.org
* Must use an API key. Go to your account page and generate a key.

## Example: Creating new config file for first use

Expand All @@ -21,6 +32,6 @@ Using an existing config file publish a new iasl.exe. See the example file **ia
6. Open cmd prompt in the NugetPublishing dir
7. Pack and push (here is my example command. )
```cmd
NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath iasl.config.json --Version 20180209.0.0 --InputFolderPath "C:\temp\iasl-win-20180209\new"
NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath iasl.config.json --Version 20180209.0.0 --InputFolderPath "C:\temp\iasl-win-20180209\new" --ApiKey <your key here>
```

38 changes: 38 additions & 0 deletions UefiBuild/NugetPublishing/iasl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# IASL Notes

This tool is the open source ACPI compiler. More information can be found at https://acpica.org/

## Where

For Windows Binary tools: https://acpica.org/downloads/binary-tools

## What

iasl.exe is the compiler.

## Version

``` cmd
iasl.exe -v
```
Nuget version is AA.BB.CC

* If the version is a single number then make it the _AA_ field and use zeros for _BB.CC_
* Example: version command is **20160912** then NuGet version is **20160912.0.0**
* If a version has two numbers partitioned by a "-" then make those the _AA.BB_ fields and use zero for the _CC_
* Example: version command is **1234-56** then NuGet version is **1234.56.0**


## Process to publish new version of tool

1. Download desired version from acpica.org
2. Unzip
3. Make a new folder (for my example I will call it "new")
4. Copy the assets to publish into this new folder (in this case just iasl.exe)
5. Run the iasl.exe -v command to see the version.
6. Open cmd prompt in the NugetPublishing dir
7. Pack and push
```cmd
NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath iasl.config.json --Version <nuget version here> --InputFolderPath <path to newly created folder here> --ApiKey <your key here>
```

0 comments on commit 65e544b

Please sign in to comment.