Skip to content

Commit

Permalink
Fix the dogfooding and simplify build script
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Jun 12, 2020
1 parent 9a679c7 commit 2320497
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ stages:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
MAVEN_OPTS: '-Xmx3072m -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
commonMavenArguments: -B -e -Pdeploy-sonarsource -Dmaven.test.skip=true
fixedBranch: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]
steps:
- checkout: self
fetchDepth: 1
Expand Down Expand Up @@ -55,28 +56,14 @@ stages:
sudo apt-get install rng-tools
sudo service rng-tools start
displayName: Fix entropy to speed up JAR signing
- task: PythonScript@0
name: fixBranchName
displayName: 'Compute short branch name for buildInfo'
inputs:
scriptSource: 'inline'
script: |
branch = "$(Build.SourceBranch)"
refPrefix = "refs/heads/"
if branch.startswith(refPrefix):
fixedBranch = branch[len(refPrefix):]
else:
fixedBranch = branch
# Workaround for https://github.com/Microsoft/azure-pipelines-agent/issues/838
print("##vso[task.setvariable variable=fixedBranch;isOutput=true]" + fixedBranch)
- task: Maven@3
displayName: 'Run Maven deploy with signing'
condition: ne(variables['Build.Reason'], 'PullRequest')
env:
ARTIFACTORY_DEPLOY_USERNAME: $(ARTIFACTORY_DEPLOY_USERNAME)
ARTIFACTORY_DEPLOY_PASSWORD: $(ARTIFACTORY_DEPLOY_PASSWORD)
GIT_SHA1: $(Build.SourceVersion)
GITHUB_BRANCH: $(fixBranchName.fixedBranch)
GITHUB_BRANCH: $(fixedBranch)
inputs:
goals: 'deploy'
options: >-
Expand Down Expand Up @@ -360,7 +347,7 @@ stages:
burgrType: 'dogfood'
stageName: 'update_dogfood_repo'
stageDisplayName: Update internal dogfooding p2
stageCondition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
stageCondition: and(succeeded(), eq(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'master'))
stageDependencies: promote
jobs:
- job: copyUpdateSite
Expand Down Expand Up @@ -395,7 +382,13 @@ stages:
# PROJECT_VERSION is set by the compute-build-version-step.yml
version = buildInfoProperties.get('buildInfo.env.PROJECT_VERSION', 'NOT_FOUND')
copyApiUrl = f"$(ARTIFACTORY_URL)/api/copy/sonarsource-public-builds/org/sonarsource/sonarlint/eclipse/org.sonarlint.eclipse.site/{version}/org.sonarlint.eclipse.site-{version}.zip?to=/sonarlint-eclipse-dogfood/org.sonarlint.eclipse.site-dogfood.zip\&suppressLayouts=1"
copyApiUrl = f"$(ARTIFACTORY_URL)/api/copy/sonarsource-public-builds/org/sonarsource/sonarlint/eclipse/org.sonarlint.eclipse.site/{version}/org.sonarlint.eclipse.site-{version}.zip?to=/sonarlint-eclipse-dogfood/org.sonarlint.eclipse.site-dogfood.zip"
response = requests.post(url=copyApiUrl, auth=('$(ARTIFACTORY_API_USER)', '$(ARTIFACTORY_API_KEY)'))
if not response.status_code == 200:
sys.exit('[!] [{0}] Server Error: {1}'.format(response.status_code, response.text))
# Hack for https://stackoverflow.com/questions/62345615/artifactory-cloud-how-to-copy-an-artifact-without-messing-up-the-repo-path-in
copyApiUrl2 = f"$(ARTIFACTORY_URL)/api/copy/sonarlint-eclipse-dogfood/org.sonarlint.eclipse.site-dogfood.zip?to=/sonarsource-public-builds/org/sonarsource/sonarlint/eclipse/org.sonarlint.eclipse.site/{version}/org.sonarlint.eclipse.site-{version}.zip"
response2 = requests.post(url=copyApiUrl2, auth=('$(ARTIFACTORY_API_USER)', '$(ARTIFACTORY_API_KEY)'))
if not response2.status_code == 200:
sys.exit('[!] [{0}] Server Error: {1}'.format(response2.status_code, response2.text))

0 comments on commit 2320497

Please sign in to comment.