Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into agrifood/test-infra

* 'master' of https://github.com/Azure/azure-sdk-for-python:
  replace response urls too (Azure#18758)
  [AutoRelease] t2-resource-2021-05-19-78417 (Azure#18807)
  [pipeline]update autorest version for pipeline (Azure#18782)
  [AutoRelease] t2-digitaltwins-2021-05-18-25594(wave4) (Azure#18786)
  [AutoRelease] t2-hybridkubernetes-2021-05-19-49364(wave4) (Azure#18802)
  Added Async APIs and Samples for attestation SDK (Azure#18735)
  [AVA] Updating links in package ReadMe (Azure#18800)
  Sync eng/common directory with azure-sdk-tools for PR 1585 (Azure#18793)
  • Loading branch information
iscai-msft committed May 19, 2021
2 parents aa93e0b + 87d7dc5 commit fb62729
Show file tree
Hide file tree
Showing 507 changed files with 11,605 additions and 7,236 deletions.
102 changes: 77 additions & 25 deletions eng/common/pipelines/templates/steps/docs-metadata-release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,65 @@
# intended to be used as part of a release process
parameters:
ArtifactLocation: 'not-specified'
PackageRepository: 'not-specified'
ReleaseSha: 'not-specified'
RepoId: $(Build.Repository.Name)
WorkingDirectory: ''
ScriptDirectory: eng/common/scripts
TargetDocRepoName: ''
TargetDocRepoOwner: ''
PRBranchName: 'master-rdme'
PRLabels: 'auto-merge'
ArtifactName: ''
Language: ''
DocRepoDestinationPath: '' #usually docs-ref-services/
CIConfigs: '[]'
GHReviewersVariable: ''
GHTeamReviewersVariable: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step
OnboardingBranch: ''
CloseAfterOpenForTesting: false
SkipPackageJson: false
- name: ArtifactLocation
type: string
default: 'not-specified'
- name: PackageRepository
type: string
default: 'not-specified'
- name: ReleaseSha
type: string
default: 'not-specified'
- name: RepoId
type: string
default: $(Build.Repository.Name)
- name: WorkingDirectory
type: string
default: ''
- name: ScriptDirectory
type: string
default: eng/common/scripts
- name: TargetDocRepoName
type: string
default: ''
- name: TargetDocRepoOwner
type: string
default: ''
- name: PRBranchName
type: string
default: 'master-rdme'
- name: PRLabels
type: string
default: 'auto-merge'
- name: ArtifactName
type: string
default: ''
- name: Language
type: string
default: ''
- name: DocRepoDestinationPath
type: string
default: '' #usually docs-ref-services/
- name: CIConfigs
type: string
default: '[]'
- name: GHReviewersVariable
type: string
default: ''
- name: GHTeamReviewersVariable
type: string
default: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step
- name: OnboardingBranch
type: string
default: ''
- name: CloseAfterOpenForTesting
type: boolean
default: false
- name: SkipPackageJson
type: object
default: false
- name: SparseCheckoutPaths
type: object
default: null

steps:
- pwsh: |
Expand All @@ -30,14 +71,25 @@ steps:
Write-Host "This script is not executing on Windows, skipping registry modification."
}
displayName: Enable Long Paths if Necessary

- pwsh: |
git clone https://github.com/${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }} ${{ parameters.WorkingDirectory }}/repo
displayName: Clone Documentation Repository
ignoreLASTEXITCODE: false

- ${{ if not(parameters.SparseCheckoutPaths) }}:
- pwsh: |
git clone https://github.com/${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }} ${{ parameters.WorkingDirectory }}/repo
displayName: Clone Documentation Repository
ignoreLASTEXITCODE: false
- ${{ if parameters.SparseCheckoutPaths }}:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
SkipDefaultCheckout: true
Repositories:
- Name: ${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }}
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
Paths: ${{ parameters.SparseCheckoutPaths }}

- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
parameters:
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
- task: PowerShell@2
displayName: 'Apply Documentation Updates From Artifact'
inputs:
Expand Down
5 changes: 3 additions & 2 deletions eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ steps:
displayName: Init sparse checkout ${{ repo.Name }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
- pwsh: git checkout ${{ repo.Commitish }}
displayName: Sparse checkout at ${{ repo.Commitish }}
- pwsh: |
git checkout ${{ repo.Commitish }} # this will use the default branch if repo.Commitish is empty
displayName: Sparse checkout at ${{ coalesce(repo.Commitish, 'default branch') }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
4 changes: 2 additions & 2 deletions sdk/attestation/azure-security-attestation/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
include azure/security/__init__.py

recursive-include samples *.py *.md
recursive-include tests *.py *.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def get_policy(self, attestation_type, **kwargs):
:param azure.security.attestation.AttestationType attestation_type: :class:`azure.security.attestation.AttestationType` for
which to retrieve the policy.
:return AttestationResponse[str]: Attestation service response encapsulating a string attestation policy.
:return azure.security.attestation.AttestationResponse[str]: Attestation service response encapsulating a string attestation policy.
:raises AttestationTokenValidationException: Raised when an attestation token is invalid.
:raises azure.security.attestation.AttestationTokenValidationException: Raised when an attestation token is invalid.
"""

Expand All @@ -93,17 +93,17 @@ def get_policy(self, attestation_type, **kwargs):
return AttestationResponse[str](token, actual_policy.decode('utf-8'))

@distributed_trace
def set_policy(self, attestation_type, attestation_policy, **kwargs):
def set_policy(self, attestation_type, attestation_policy, signing_key=None, **kwargs):
#type:(AttestationType, str, Optional[AttestationSigningKey], **Any) -> AttestationResponse[PolicyResult]
""" Sets the attestation policy for the specified attestation type.
:param azure.security.attestation.AttestationType attestation_type: :class:`azure.security.attestation.AttestationType` for
which to set the policy.
:param str attestation_policy: Attestation policy to be set.
:keyword AttestationSigningKey signing_key: Signing key to be
:keyword azure.security.attestation.AttestationSigningKey signing_key: Signing key to be
used to sign the policy before sending it to the service.
:return AttestationResponse[PolicyResult]: Attestation service response encapsulating a :class:`PolicyResult`.
:raises AttestationTokenValidationException: Raised when an attestation token is invalid.
:return azure.security.attestation.AttestationResponse[azure.security.attestation.PolicyResult]: Attestation service response encapsulating a :class:`PolicyResult`.
:raises azure.security.attestation.AttestationTokenValidationException: Raised when an attestation token is invalid.
.. note::
If the attestation instance is in *Isolated* mode, then the
Expand All @@ -115,7 +115,6 @@ def set_policy(self, attestation_type, attestation_policy, **kwargs):
"""

signing_key = kwargs.get('signing_key', None) #type:AttestationSigningKey
policy_token = AttestationToken[GeneratedStoredAttestationPolicy](
body=GeneratedStoredAttestationPolicy(attestation_policy = attestation_policy.encode('ascii')),
signer=signing_key,
Expand All @@ -130,17 +129,17 @@ def set_policy(self, attestation_type, attestation_policy, **kwargs):
return AttestationResponse[PolicyResult](token, PolicyResult._from_generated(token.get_body()))

@distributed_trace
def reset_policy(self, attestation_type, **kwargs):
#type:(AttestationType, **dict[str, Any]) -> AttestationResponse[PolicyResult]
def reset_policy(self, attestation_type, signing_key=None, **kwargs):
#type:(AttestationType, Optional[AttestationSigningKey], **dict[str, Any]) -> AttestationResponse[PolicyResult]
""" Resets the attestation policy for the specified attestation type to the default value.
:param azure.security.attestation.AttestationType attestation_type: :class:`azure.security.attestation.AttestationType` for
which to set the policy.
:param str attestation_policy: Attestation policy to be reset.
:keyword AttestationSigningKey signing_key: Signing key to be
:keyword azure.security.attestation.AttestationSigningKey signing_key: Signing key to be
used to sign the policy before sending it to the service.
:return AttestationResponse[PolicyResult]: Attestation service response encapsulating a :class:`PolicyResult`.
:raises AttestationTokenValidationException: Raised when an attestation token is invalid.
:return azure.security.attestation.AttestationResponse[azure.security.attestation.PolicyResult]: Attestation service response encapsulating a :class:`PolicyResult`.
:raises azure.security.attestation.AttestationTokenValidationException: Raised when an attestation token is invalid.
.. note::
If the attestation instance is in *Isolated* mode, then the
Expand All @@ -150,7 +149,6 @@ def reset_policy(self, attestation_type, **kwargs):
If the attestation instance is in *AAD* mode, then the `signing_key`
parameter does not need to be provided.
"""
signing_key = kwargs.get('signing_key', None) #type:AttestationSigningKey
policy_token = AttestationToken(
body=None,
signer=signing_key)
Expand All @@ -172,7 +170,7 @@ def get_policy_management_certificates(self, **kwargs):
The list of policy management certificates will only be non-empty if the
attestation service instance is in Isolated mode.
:return AttestationResponse[list[list[bytes]]: Attestation service response
:return azure.security.attestation.AttestationResponse[list[list[bytes]]: Attestation service response
encapsulating a list of DER encoded X.509 certificate chains.
"""

Expand All @@ -199,9 +197,9 @@ def add_policy_management_certificate(self, certificate_to_add, signing_key, **k
:param bytes certificate_to_add: DER encoded X.509 certificate to add to
the list of attestation policy management certificates.
:param AttestationSigningKey signing_key: Signing Key representing one of
:param azure.security.attestation.AttestationSigningKey signing_key: Signing Key representing one of
the *existing* attestation signing certificates.
:return AttestationResponse[PolicyCertificatesModificationResult]: Attestation service response
:return azure.security.attestation.AttestationResponse[azure.security.attestation.PolicyCertificatesModificationResult]: Attestation service response
encapsulating the status of the add request.
The :class:`PolicyCertificatesModificationResult` response to the
Expand Down Expand Up @@ -240,9 +238,9 @@ def remove_policy_management_certificate(self, certificate_to_add, signing_key,
:param bytes certificate_to_add: DER encoded X.509 certificate to add to
the list of attestation policy management certificates.
:param AttestationSigningKey signing_key: Signing Key representing one of
:param azure.security.attestation.AttestationSigningKey signing_key: Signing Key representing one of
the *existing* attestation signing certificates.
:return AttestationResponse[PolicyCertificatesModificationResult]: Attestation service response
:return azure.security.attestation.AttestationResponse[azure.security.attestation.PolicyCertificatesModificationResult]: Attestation service response
encapsulating a list of DER encoded X.509 certificate chains.
The :class:`PolicyCertificatesModificationResult` response to the
Expand Down Expand Up @@ -285,11 +283,7 @@ def _get_signers(self, **kwargs):
self._signing_certificates = []
for key in signing_certificates.keys:
# Convert the returned certificate chain into an array of X.509 Certificates.
certificates = []
for x5c in key.x5_c:
der_cert = base64.b64decode(x5c)
certificates.append(der_cert)
self._signing_certificates.append(AttestationSigner(certificates, key.kid))
self._signing_certificates.append(AttestationSigner._from_generated(key))
signers = self._signing_certificates
return signers

Expand Down
Loading

0 comments on commit fb62729

Please sign in to comment.