From 23aad0bab101c4d2590f093d8de8ce67bbd571ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezequiel=20P=C3=A1ssaro?= Date: Wed, 20 May 2020 10:25:11 -0300 Subject: [PATCH] Split release pipeline (#1142) * Initial commit [skip ci] * Skip CI when updating JSON. Move to azure-pipelines folder * Split release pipeline * Comment PR trigger * Uncomment PR trigger --- azure-pipelines/release-version.yml | 109 --------------------- azure-pipelines/update-zenodo-json.yml | 129 +++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 109 deletions(-) create mode 100644 azure-pipelines/update-zenodo-json.yml diff --git a/azure-pipelines/release-version.yml b/azure-pipelines/release-version.yml index 93a506ffac9..79999451412 100644 --- a/azure-pipelines/release-version.yml +++ b/azure-pipelines/release-version.yml @@ -15,123 +15,14 @@ schedules: variables: system.debug: "true" - tardis.zenodo.home: "$(Agent.BuildDirectory)/tardis_zenodo" - tardis.zenodo.access: $(epassaro_pat) tardis.build.dir: $(Build.Repository.LocalPath) pool: vmImage: "ubuntu-latest" jobs: - - job: zenodo_json - displayName: Create Zenodo JSON file - steps: - - - task: DownloadSecureFile@1 - inputs: - secureFile: 'id_azure_rsa' - - - task: InstallSSHKey@0 - inputs: - knownHostsEntry: $(gh_host) - sshPublicKey: $(public_key) - sshKeySecureFile: 'id_azure_rsa' - - - task: DownloadSecureFile@1 - name: zenodoSecretKey - displayName: "Download Zenodo secret key" - inputs: - secureFile: "key_secret.json" - - - task: DownloadSecureFile@1 - name: authorOrder - displayName: "Download author order file" - inputs: - secureFile: "author_order.txt" - - - task: DownloadSecureFile@1 - name: nonCommitContributors - displayName: "Download non commit contributors file" - inputs: - secureFile: "non_commit_contributors.txt" - - - bash: | - echo "##vso[task.prependpath]$CONDA/bin" - sudo chown -R $USER $CONDA - displayName: "Add CONDA to path" - - - bash: | - conda create -n zenodo python=3.6 --yes - source activate zenodo - conda install jupyter nbconvert numpy pandas orcid -c conda-forge --yes - displayName: "Create Zenodo env" - - - bash: | - cd .. - git clone https://$(tardis.zenodo.access)@github.com/tardis-sn/tardis_zenodo.git - displayName: "Clone tardis_zenodo repo" - - - bash: | - cp $(zenodoSecretKey.secureFilePath) $(tardis.zenodo.home) - cp $(authorOrder.secureFilePath) $(tardis.zenodo.home) - cp $(nonCommitContributors.secureFilePath) $(tardis.zenodo.home) - displayName: "Recovering secrets" - - - bash: | - source activate zenodo - cd $(tardis.zenodo.home) - jupyter nbconvert gather_data.ipynb --to html --allow-errors --execute --ExecutePreprocessor.timeout=6000 - displayName: "Running notebook (allow errors)" - - - bash: | - source activate zenodo - cd $(tardis.zenodo.home) - jupyter nbconvert gather_data.ipynb --to html --execute --ExecutePreprocessor.timeout=6000 - displayName: "Running notebook (not allow errors)" - - # This step should fail if there are changes in .zenodo.json - #- bash: | - # diff $(tardis.zenodo.home)/.zenodo.json .zenodo.json - # displayName: "Look for changes in JSON" - - - bash: | - set -e - - cd .. - git clone git@github.com:tardis-sn/tardis.git out - cd out - - git config --local user.name "Azure Pipelines" - git config --local user.email "azuredevops@microsoft.com" - cp $(tardis.zenodo.home)/.zenodo.json .zenodo.json - git add .zenodo.json - - if git diff --staged --quiet; then - echo "Exiting with no changes" - exit 0 - else - git commit -m "Update zenodo.json" - git push origin master - fi - displayName: "Push zenodo.json to master branch" - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: "$(tardis.zenodo.home)/.zenodo.json" - artifact: "zenodo_json" - publishLocation: "pipeline" - condition: succeededOrFailed() - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: "$(tardis.zenodo.home)/gather_data.html" - artifact: "report" - publishLocation: "pipeline" - condition: succeededOrFailed() - - job: gh_release displayName: Upload GitHub release - dependsOn: zenodo_json steps: - bash: | echo "##vso[task.prependpath]$CONDA/bin" diff --git a/azure-pipelines/update-zenodo-json.yml b/azure-pipelines/update-zenodo-json.yml new file mode 100644 index 00000000000..666fc543abd --- /dev/null +++ b/azure-pipelines/update-zenodo-json.yml @@ -0,0 +1,129 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: none +pr: none +schedules: + - cron: "30 22 * * 5" + displayName: Weekly update + branches: + include: + - master + always: true + +variables: + system.debug: "true" + tardis.zenodo.home: "$(Agent.BuildDirectory)/tardis_zenodo" + tardis.zenodo.access: $(epassaro_pat) + tardis.build.dir: $(Build.Repository.LocalPath) + +pool: + vmImage: "ubuntu-latest" + +jobs: + - job: zenodo_json + displayName: Create Zenodo JSON file + steps: + - task: DownloadSecureFile@1 + inputs: + secureFile: "id_azure_rsa" + + - task: InstallSSHKey@0 + inputs: + knownHostsEntry: $(gh_host) + sshPublicKey: $(public_key) + sshKeySecureFile: "id_azure_rsa" + + - task: DownloadSecureFile@1 + name: zenodoSecretKey + displayName: "Download Zenodo secret key" + inputs: + secureFile: "key_secret.json" + + - task: DownloadSecureFile@1 + name: authorOrder + displayName: "Download author order file" + inputs: + secureFile: "author_order.txt" + + - task: DownloadSecureFile@1 + name: nonCommitContributors + displayName: "Download non commit contributors file" + inputs: + secureFile: "non_commit_contributors.txt" + + - bash: | + echo "##vso[task.prependpath]$CONDA/bin" + sudo chown -R $USER $CONDA + displayName: "Add CONDA to path" + + - bash: | + conda create -n zenodo python=3.6 --yes + source activate zenodo + conda install jupyter nbconvert numpy pandas orcid -c conda-forge --yes + displayName: "Create Zenodo env" + + - bash: | + cd .. + git clone https://$(tardis.zenodo.access)@github.com/tardis-sn/tardis_zenodo.git + displayName: "Clone tardis_zenodo repo" + + - bash: | + cp $(zenodoSecretKey.secureFilePath) $(tardis.zenodo.home) + cp $(authorOrder.secureFilePath) $(tardis.zenodo.home) + cp $(nonCommitContributors.secureFilePath) $(tardis.zenodo.home) + displayName: "Recovering secrets" + + - bash: | + source activate zenodo + cd $(tardis.zenodo.home) + jupyter nbconvert gather_data.ipynb --to html --allow-errors --execute --ExecutePreprocessor.timeout=6000 + displayName: "Running notebook (allow errors)" + + - bash: | + source activate zenodo + cd $(tardis.zenodo.home) + jupyter nbconvert gather_data.ipynb --to html --execute --ExecutePreprocessor.timeout=6000 + displayName: "Running notebook (not allow errors)" + + # This step should fail if there are changes in .zenodo.json + #- bash: | + # diff $(tardis.zenodo.home)/.zenodo.json .zenodo.json + # displayName: "Look for changes in JSON" + + - bash: | + set -e + + cd .. + git clone git@github.com:tardis-sn/tardis.git out + cd out + + git config --local user.name "Azure Pipelines" + git config --local user.email "azuredevops@microsoft.com" + cp $(tardis.zenodo.home)/.zenodo.json .zenodo.json + git add .zenodo.json + + if git diff --staged --quiet; then + echo "Exiting with no changes" + exit 0 + else + git commit -m "Update zenodo.json [skip ci]" + git push origin master + fi + displayName: "Push zenodo.json to master branch" + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: "$(tardis.zenodo.home)/.zenodo.json" + artifact: "zenodo_json" + publishLocation: "pipeline" + condition: succeededOrFailed() + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: "$(tardis.zenodo.home)/gather_data.html" + artifact: "report" + publishLocation: "pipeline" + condition: succeededOrFailed()