|
| 1 | +# Starter pipeline |
| 2 | +# https://aka.ms/yaml |
| 3 | + |
| 4 | +parameters: |
| 5 | +- name: JOB_NAME |
| 6 | + displayName: 'Job name' |
| 7 | + default: 'wm-msr#10.15' |
| 8 | +- name: TAG |
| 9 | + displayName: Tag the created image with this name, e.g. wm-msr:10.15 |
| 10 | + default: 'wm-msr:10.15' |
| 11 | +- name: PRODUCTS |
| 12 | + displayName: List of product components inside image (separated by comma) |
| 13 | + default: 'MSC,Monitor,PIEContainerExternalRDBMS' |
| 14 | +- name: RELEASE |
| 15 | + displayName: Dowmload product components from release version |
| 16 | + default: '10.15' |
| 17 | +- name: ADMIN_PASSWORD |
| 18 | + default: 'manage' |
| 19 | + displayName: Define Administrator password for installed product components |
| 20 | +- name: BASE_IMAGE |
| 21 | + default: 'registry.access.redhat.com/ubi8/ubi:latest' |
| 22 | + displayName: 'Create new image based on this' |
| 23 | +- name: VARIABLE_GROUP |
| 24 | + default: 'webmethods-image-creator-vars' |
| 25 | + displayName: 'Use parameters from Variable Group' |
| 26 | + |
| 27 | +variables: |
| 28 | +- group: ${{parameters.VARIABLE_GROUP}} |
| 29 | + |
| 30 | +trigger: |
| 31 | +- none |
| 32 | + |
| 33 | +name: '${{parameters.JOB_NAME}}' # Pipeline run number. |
| 34 | +appendCommitMessageToRunName: false # Append the commit message to the build number. The default is true. |
| 35 | + |
| 36 | +pool: |
| 37 | + name: $(AGENT_POOL) |
| 38 | + vmImage: ubuntu-latest |
| 39 | + |
| 40 | +steps: |
| 41 | +- script: | |
| 42 | + apt-get update |
| 43 | + apt-get install docker.io |
| 44 | + displayName: 'Install Docker CLI' |
| 45 | + |
| 46 | +- script: | |
| 47 | + echo 'Login to: $(REGISTRY_HOST)' |
| 48 | + docker login -u '$(REGISTRY_USERNAME)' -p '$(REGISTRY_PASSWORD)' $(REGISTRY_HOST) |
| 49 | + displayName: 'Login Docker registry' |
| 50 | + |
| 51 | +- script: | |
| 52 | + echo 'Download Installer from Empower by release date: $(INSTALLER_VERSION)' |
| 53 | + curl https://empowersdc.softwareag.com/ccinstallers/SoftwareAGInstaller$(INSTALLER_VERSION)-Linux_x86_64.bin -o installer.bin |
| 54 | + displayName: 'Download Installer from Empower' |
| 55 | + |
| 56 | +- script: | |
| 57 | + echo '$(EMPOWER_PASSWORD)' > pass.txt |
| 58 | + sh installer.bin create container-image --name '${{parameters.TAG}}' --release '${{parameters.RELEASE}}' --accept-license --products '${{parameters.PRODUCTS}}' --username '$(EMPOWER_USERNAME)' --password:file=pass.txt --admin-password '${{parameters.ADMIN_PASSWORD}}' --base-image '${{parameters.BASE_IMAGE}}' -proxyHost '$(PROXY_HOST)' -proxyPort '$(PROXY_PORT)' |
| 59 | + rm pass.txt |
| 60 | + displayName: 'Start Installer to create image' |
| 61 | + |
| 62 | +- script: |
| 63 | + find . -name "installLog.txt" | xargs cat |
| 64 | + displayName: 'Print out Installer log' |
| 65 | + |
| 66 | +- script: | |
| 67 | + echo 'Push image $(REGISTRY_HOST)/$(REGISTRY_PROJECT)/${{parameters.TAG}} ...' |
| 68 | + docker tag '${{parameters.TAG}}' '$(REGISTRY_HOST)/$(REGISTRY_PROJECT)/${{parameters.TAG}}' |
| 69 | + docker push '$(REGISTRY_HOST)/$(REGISTRY_PROJECT)/${{parameters.TAG}}' |
| 70 | + displayName: 'Push image to Docker registry' |
| 71 | + |
| 72 | +- script: |
| 73 | + docker rmi '${{parameters.TAG}}' '$(REGISTRY_HOST)/$(REGISTRY_PROJECT)/${{parameters.TAG}}' |
| 74 | + displayName: 'Remove local Docker images' |
0 commit comments