Telnet is a protocol that uses a virtual terminal connection on the Internet or a local area network to provide two-way interactive text communication devices.
It is one of the earliest Internet protocol protocols. Since its inception in 1969, it has been around for nearly 50 years and has a wide range of users in open operating systems.
Although due to its security shortcomings, has been gradually eliminated, but on many AIX system servers, operators are accustomed to using Telnet as their primary tool to maintain the server system. TFS System as a product of the Application Lifecycle Management (ALM) platform, the native provides SSH tools to connect to the Linux system, unfortunately there is no tool to provide telnet, here I describe how to use the Telnet tool in ant to implement the Telnet server in continuous integration and publishing connection.
First, the necessary software
-Visual Studio Team Foundation Server 2017 +
-Ant 1.9 +
-Telnet task:https://ant.apache.org/manual/tasks/telnet.html
Copy the Dependency package (Commons-net-3.6.jar) containing this feature into the Ant's Lib folder, for example my path is: D:\apache-ant-1.9.5-bin\apache-ant-1.9.5\lib
-Java 1.8 +
-Aix telnet Server (or Telnet server on other server)
Second, write the ant script that contains the Telnet task
Is the simplest ant script that contains only one Telnet task, creating a folder on the server
<project name= "Project" basedir= "." default= "Telnet" > <target name= "Telnet" > <telnet userid= "admin" password= "p2ssw0rd" server= "192.168.20.7" > <read>/home/bob</read> <write>dir</write> <read string= "/home/bob"/> <write>mkdir foldercreatedbytelnettask</write> </telnet> </target> </project>
|
Note: The Telnet task provides only two tools, "read" and "writer", the functions of this two tool are as follows:
-read: Reads the character information returned by the Telnet server in order to execute the command in the following write, and the subsequent command will not execute if the correct character is not read. For example, the Telnet server on an AIX server always returns #, then I enter <read>#</read> in front of each instruction
-Write: Telnet server that sends the characters in the label as instructions
Iii. adding ant tasks to TFS continuous integration/Release
(Microsoft ALM MVP Zhang Hongjun Http://www.cnblogs.com/zhanghongjun )
During continuous integration or continuous release, add an ant task that specifies the ant script written above, and the TFS system will automatically connect to the Telnet server and execute the commands you have written, such as:
Finish
Perform the Telnet task in TFS Continuous Integration (continuous release)