Automated Build Deployment Process — Azure
Introduction
The automated build deployment process helps simplify the promotion of changes from the development environment to the production environment. The Simple Change Framework (SCF), based on Ant scripts, is developed by PTC to support this automation. SCF helps package the changes necessary to update a Windchill environment using the Automated Deployment process which is required for Windchill+. It also helps standardize both the packaging and installation process, as well as reuse existing deployment and installation features. The SCF provides support for file deployment, Xconf and property management, RBInfo and Java compilation, wtSafeArea support, and additional customizations (for example, LoadFiles, LoadFileset, and LCSLoadFiles).
Downloading the Simple Change Framework Artifacts
On the PTC Cloud Server, use the following command to download the SCF artifacts:
go scf.latest
The SCF artifacts contains the following /appl/ptc/scripts/SimpleChangeFramework :
• Structured package template – A zip file with a predefined folder structure.
• Installation guide templates for four different types of installations - All, Load, Copy, and Deploy.
• Sample of Delivery Note – A document listing the package contents and status of installation steps.
• Samples of build packages illustrating individual use cases.
SCF Directory Structure
The SCF directory contains the following:
• build.properties and build.xml files are used to configure the deployment operations.
• ant folder containing the scripts necessary to orchestrate the operations.
• Other folders as placeholders for developers’ reference to copy the content at the right place.
Creating and Deploying a Build Package
You can create and deploy build packages automatically. There are three main steps to deploy configuration changes with the PTC cloud:
1. Create a Build Package
2. Upload to PTC Cloud
3. Trigger Automated Deployment
Step 1. Create a Build Package
There are three methods to create a build package:
• Using a package template
• From a PTC cloud integration environment
• Using a configuration management system
Create a Build Package Using a Package Template
To create and deploy build package using a package template follow the steps given below:
1. Create the package structure by unzipping the package template.
2. Move the files corresponding to the expected changes to their respective locations in the folder structure.
3. Declare the Load files sequence and specific property changes in build.xml file.
4. Modify the build.properties file to change the version number, component name, and installation type.
5. Zip all the files into a deliverable package.
For detailed instructions for each of the above steps, refer to the video
here.
Create a Build Package from a PTC Cloud Integration Environment
The steps to build a package from a PTC Cloud integration environment are given below:
| The Ant tools used for this method are available only on PTC Cloud environment. |
1. Create an empty package structure using the command go package.prepare.
2. Use the definition exporter to export either Types or Global enumerations: go exporter.type or go exporter.enum.
3. Make manual changes – include Java source files, rbInfo files, load files, or any other required files in the Package structure.
4. Declare the Load files sequence and specific property changes in the build.xml file.
5. Modify the build.properties file to change the version number, component name, and installation type.
6. Zip all changes together using the command go package.gen.zip.
Create a Build Package using a Configuration Management System
This method is specific to your configuration management plan and is equivalent to the first method of creating a build package using a package template.
| • The SCM branch must follow the SCF folder structure. • The ant folder as well as the build.properties and build.xml properties files must be managed in your source control management system. • SCF version update must be managed in this SCM tool. |
The steps to generate a package out of an SCM tool are given below:
1. Use the SCM history mechanism to define the specific content of the build.xml file.
2. Increment the version by modifying the build.properties file.
3. Commit the changes.
| At this stage, it is recommended to create a separate tag to properly identify the delivered package in the SCM tool since a tag can be reused later as reference to create a hotfix. |
4. Zip either the branch or the tag.
Step 2. Upload to PTC Cloud
The generated ZIP file can be uploaded to Azure Blob storage or AWS S3 bucket. This section explains the procedure for uploading the package to Azure Blob storage.
Prerequisite:
An Azure Blob storage should be set up and authorization details should be obtained from PTC Cloud.
| You must enter the Azure Blob Storage name in the following format : ptccustomerxxxxrrr Here, xxxx is the customer short name. (Example: acme). rrr is the region where the blob storage has been provisioned. (Example: euw). Based on our example, the Blob Storage name would be: ptccustomeracmeeuw. |
Upload Package to Azure Blob
You can upload the build either from a cloud instance or from your local computer.
Upload Build from Cloud Instance
To upload the build to Azure Blob from a cloud instance, execute the following commands:
cd /<path>
azcopy login --identity
azcopy cp <build>.zip https://ptccustomerxxxxrrr.blob.core.windows.net/data/builds/
Upload Build from Local Computer
You can upload the build to Azure Blob from your local computer using Unix Shell, Windows CMD, PowerShell, or Microsoft Azure Storage Explorer. To upload the build to Azure Blob from Linux Shell, execute the following commands:
cd /<path>
azcopy login
azcopy cp <build>.zip https://ptccustomerxxxxrrr.blob.core.windows.net/data/builds/
To upload from Windows CMD or PowerShell, execute the following commands:
cd \<path>
azcopy login
azcopy cp <build>.zip https://ptccustomerxxxxrrr.blob.core.windows.net/data/builds/
To upload using Microsoft Azure Storage Explorer, follow the steps given below:
1. Locate the build file locally and the target folder (data/builds) in the Blob Container.
2. Either drag and drop or upload the build file to the target folder.
| If you are prompted for Storage Access Policy, click ok. |
3. After the transaction is complete, verify the transfer status is ok.
Step 3. Trigger Automated Deploy
To trigger the package deployment, you need a manifest file. The manifest file is an YML file that describes where and when a specific build should be deployed. The steps to create a manifest file are given below.
Pre-requisite
The environment that defines the deployment pipeline should be configured by PTC Cloud, and the corresponding environment identifiers should be obtained from the PTC team before proceeding to the next steps.
| • Use any text editor to create the manifest file. • The filename can be any, but the extension must be .yml. • You can reuse the same filename every time or create a new one for each package being deployed. |
Details of the attributes in manifest file are given below:
Attribute | Description | Possible values |
deploy_pipe | Defines the pipeline where the build package should be installed. The deploy_pipe attribute lists the environments to deploy the build. Normally, intN describes a single Integration environment and pipelineN describes both QA and Production environments. | intN / pipelineN / intN,pipelineN examples: deploy_pipe: pipeline1 deploy_pipe: int1 deploy_pipe: int2, pipeline1 There cannot be listed more than one intN or pipelineN per manifest file. |
package_description | Brief description of the build package contents or its purpose. | Free text |
package_name | File name of the build package with extension .zip | <Build>.zip CASE must be respected. |
duration | Expected deployment duration time in hours. | Number |
date_time_int | Expected date when the build should be deployed on the Integration environment. | Time is in 24H format in Eastern Time. |
| YYYY/MM/DD hh:mm:ss 2021/01/30 14:00:00 |
date_time_qa | Expected date when the build should be deployed on the QA environment. | Time is in 24H format in Eastern Time. |
| YYYY/MM/DD hh:mm:ss 2021/01/30 14:00:00 |
date_time_prod | Expected date when the build should be deployed on the Production environment. | Time is in 24H format in Eastern Time. |
| YYYY/MM/DD hh:mm:ss 2021/01/30 14:00:00 |
notify | Comma-separated list of emails to send notification during the deployment process. | user1@company.com,user2@company.com |
An example of the manifest file is given below.
#Describes the deployment of build pipeline
deploy_pipe: int1,pipeline1
package_description: Package for Lambda TEST
package_name: SCF_DEPLOY-RBINFO_11.0.1_V1.1.1.zip
duration: 2
date_time_int: 2021/02/22 00:00:00
date_time_qa: 2021/02/22 01:00:00
date_time_prod: 2021/02/22 02:00:00
notify: someone1@somewhere.com,someone2@somewhere.com
From a PTC Cloud environment the manifest file can be generated using the following commands :
go package.gen.manifest
Or generate manifest and create ZIP together:
go package.gen.zip.and.manifest
After the manifest.yml file is created, upload it to the shared location using any of the methods described in the next section.
Upload Manifest to Azure Blob
You can upload the manifest either from a cloud instance or from your local computer.
Upload Manifest from Cloud Instance
To upload the manifest using Linux Tools, execute the following commands:
cd /<path>
azcopy login --identity
azcopy cp <manifest>.yml https://ptccustomerxxxxrrr.blob.core.windows.net/data/builds/deploy/
Upload Manifest from Local Computer
To upload using Linux shell, execute the following commands:
cd /<path>
azcopy login
azcopy cp <manifest>.yml https://ptccustomerxxxxrrr.blob.core.windows.net/data/builds/deploy/
To upload using Windows CMD/PowerShell, execute the following commands:
cd \<path>
azcopy login
azcopy cp <manifest>.yml https://ptccustomerxxxxrrr.blob.core.windows.net/data/builds/deploy/
To upload using Microsoft Azure Storage Explorer, follow the steps given below:
1. Locate the manifest file locally and the target folder (data/builds/deploy) in the Blob Container.
2. Either drag and drop or upload the manifest file to the target folder.
| If you are prompted for Storage Access Policy, click ok. |
3. After the transaction is complete, verify the transfer status is ok.
Parent topic