Skip to content

Commit

Permalink
Split release pipeline (#1142)
Browse files Browse the repository at this point in the history
* Initial commit

[skip ci]

* Skip CI when updating JSON. Move to azure-pipelines folder

* Split release pipeline

* Comment PR trigger

* Uncomment PR trigger
  • Loading branch information
epassaro authored May 20, 2020
1 parent 2636ed8 commit 23aad0b
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 109 deletions.
109 changes: 0 additions & 109 deletions azure-pipelines/release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
129 changes: 129 additions & 0 deletions azure-pipelines/update-zenodo-json.yml
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 23aad0b

Please sign in to comment.