Skip to content

Commit

Permalink
Provide Nightly publishing of drivers
Browse files Browse the repository at this point in the history
Push to artifactory

Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
  • Loading branch information
mbwhite authored and jt-nti committed Mar 8, 2021
1 parent fc7877a commit 2017002
Showing 1 changed file with 124 additions and 61 deletions.
185 changes: 124 additions & 61 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,67 +120,67 @@ stages:
artifactName: nodeenv-docker-image

# Run the FV tests but using the built material
- job: fvt
displayName: 'FV Tests'
dependsOn: main
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version_spec)
- task: DownloadPipelineArtifact@2
inputs:
artifact: nodeenv-docker-image
path: $(Build.SourcesDirectory)/build
- task: DownloadPipelineArtifact@2
inputs:
artifact: node-tgz
path: $(Build.SourcesDirectory)/build
- script: |
set -ev
./tools/getEdgeDocker.sh # essential to get master docker images of peer etc.
docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
docker images
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here
displayName: 'Get the latest master docker images'
- script: |
set -ev
node common/scripts/install-run-rush.js start-fabric
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
docker images | grep hyperledger && docker ps -a
node common/scripts/install-run-rush.js test:fv --verbose
node common/scripts/install-run-rush.js test:e2e --verbose
displayName: 'FV Tests'
# - job: fvt
# displayName: 'FV Tests'
# dependsOn: main
# steps:
# - task: NodeTool@0
# inputs:
# versionSpec: $(node_version_spec)
# - task: DownloadPipelineArtifact@2
# inputs:
# artifact: nodeenv-docker-image
# path: $(Build.SourcesDirectory)/build
# - task: DownloadPipelineArtifact@2
# inputs:
# artifact: node-tgz
# path: $(Build.SourcesDirectory)/build
# - script: |
# set -ev
# ./tools/getEdgeDocker.sh # essential to get master docker images of peer etc.
# docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
# docker images
# node common/scripts/install-run-rush.js install
# node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here
# displayName: 'Get the latest master docker images'
# - script: |
# set -ev
# node common/scripts/install-run-rush.js start-fabric
# node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
# docker images | grep hyperledger && docker ps -a
# node common/scripts/install-run-rush.js test:fv --verbose
# node common/scripts/install-run-rush.js test:e2e --verbose
# displayName: 'FV Tests'

- task: PublishTestResults@2
condition: or(succeeded(), failed()) # publish either way
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'FV Test results'
- task: CopyFiles@2
condition: or(succeeded(), failed()) # publish either way
inputs:
sourceFolder: $(Build.SourcesDirectory)/test
contents: |
**/*.build*.log
!**/node_modules/**
targetFolder: $(Build.ArtifactStagingDirectory)/testlogs
- script: |
mkdir -p $(Build.ArtifactStagingDirectory)/testlogs
find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} $(Build.ArtifactStagingDirectory)/testlogs \;
condition: or(succeeded(), failed())
displayName: 'Copy test logs'
- task: PublishBuildArtifacts@1
condition: or(succeeded(), failed()) # publish either way
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)/testlogs
artifactName: 'Test logs'
displayName: 'Publish test logs'
- task: PublishBuildArtifacts@1
condition: or(succeeded(), failed()) # publish either way
inputs:
pathToPublish: tools/toolchain/network/docker-compose/logs/docker.log
artifactName: nodeenv-docker-image
# - task: PublishTestResults@2
# condition: or(succeeded(), failed()) # publish either way
# inputs:
# testResultsFiles: '**/test-results.xml'
# testRunTitle: 'FV Test results'
# - task: CopyFiles@2
# condition: or(succeeded(), failed()) # publish either way
# inputs:
# sourceFolder: $(Build.SourcesDirectory)/test
# contents: |
# **/*.build*.log
# !**/node_modules/**
# targetFolder: $(Build.ArtifactStagingDirectory)/testlogs
# - script: |
# mkdir -p $(Build.ArtifactStagingDirectory)/testlogs
# find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} $(Build.ArtifactStagingDirectory)/testlogs \;
# condition: or(succeeded(), failed())
# displayName: 'Copy test logs'
# - task: PublishBuildArtifacts@1
# condition: or(succeeded(), failed()) # publish either way
# inputs:
# pathToPublish: $(Build.ArtifactStagingDirectory)/testlogs
# artifactName: 'Test logs'
# displayName: 'Publish test logs'
# - task: PublishBuildArtifacts@1
# condition: or(succeeded(), failed()) # publish either way
# inputs:
# pathToPublish: tools/toolchain/network/docker-compose/logs/docker.log
# artifactName: nodeenv-docker-image


# Job to handle the auditing of the code
Expand Down Expand Up @@ -326,4 +326,67 @@ stages:
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-nodeenv:$(BuildData.MINOR_PACKAGE_VERSION)"
env:
DOCKER_REGISTRY_USERNAME: $(DockerHub-Username)
DOCKER_REGISTRY_PASSWORD: $(DockerHub-Password)
DOCKER_REGISTRY_PASSWORD: $(DockerHub-Password)
# Stage to publish the nightly drivers
- stage: Publish_tag_nightly
dependsOn: Build_and_Test
# condition: and(succeeded(), eq(variables['Build.Reason'], 'Schedule')) # only run on the scheduled builds
condition: succeeded()
jobs:
- job: npm_publish
displayName: 'npm publish'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version_spec)
- download: current
artifact: node-tgz
- script: |
touch $(Agent.TempDirectory)/.npmrc
echo '##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Agent.TempDirectory)/.npmrc'
displayName: 'create user .npmrc file'
- script: |
set -ex -o pipefail
npm install -g npm-cli-login
npm-cli-login
displayName: 'set npmjs registry'
env:
NPM_USER: $(ARTIFACTORY_USERNAME)
NPM_PASS: $(ARTIFACTORY_PASSWORD)
NPM_EMAIL: fabric@hyperledger.org
NPM_RC_PATH: $(Agent.TempDirectory)
NPM_REGISTRY: http://hyperledger.jfrog.io:8081/artifactory/api/npm/npm-repo/
- script: |
find $(Pipeline.Workspace)/node-tgz/ -maxdepth 1 -type f -name 'fabric-*.tgz' -exec npm publish {} --tag unstable \;
displayName: 'npm publish'
- job: dockerhub_publish
steps:
- template: templates/build-data.yaml
- task: DownloadPipelineArtifact@2
inputs:
artifact: nodeenv-docker-image
path: $(Build.SourcesDirectory)/build

- script: |
wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64
chmod +x ./manifest-tool
docker image load --input build/fabric-nodeenv.tar.gz
docker images
docker login -u "${ARTIFACTORY_USERNAME}" -p "${ARTIFACTORY_PASSWORD}" hyperledger-fabric.jfrog.io
echo "Logged in to docker registry"
# tag nodeenv image to PACKAGE_VERSION
docker tag hyperledger/fabric-nodeenv hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)
# push nodeenv to repository
docker push hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)
# publish patch version (3-digit) image
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-nodeenv:$(BuildData.PACKAGE_VERSION)"
# publish minor version (2-digit) image
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-nodeenv:$(BuildData.MINOR_PACKAGE_VERSION)"
env:
DOCKER_REGISTRY_USERNAME: $(DockerHub-Username)
DOCKER_REGISTRY_PASSWORD: $(DockerHub-Password)
ARTIFACTORY_USERNAME: $(ARTIFACTORY_USERNAME)
ARTIFACTORY_PASSWORD: $(ARTIFACTORY_PASSWORD)

0 comments on commit 2017002

Please sign in to comment.