This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Docker build -f Dockerfile -t "Reponame" . | |
| //-f will look for the file nanme Dockerfile -- so we can keep any fileanme | |
| // Check the Images build using -- | |
| Docker Images | |
| //Now push the docker Image to your docker-hub repo | |
| docker tag {ImangeID} {docker-account-name}/{Image-name}:{Version} | |
| -------------------------------****************------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let arrayforeach = [1, 2, 3] | |
| console.log('--Loop using for loop--') | |
| for (let i = 0; i < arrayforeach.length; i++) { | |
| console.log(arrayforeach[i] * 2) | |
| } | |
| console.log('--Loop using forEach with anonymous function--') | |
| arrayforeach.forEach(function (el) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let cardNo = ['001', '002', '003'] | |
| // for loop and push each value to final array | |
| let getFormattedCard = [] | |
| for (let i = 0; i < cardNo.length; i++) { | |
| getFormattedCard.push(`Visa-${cardNo[i]}`); | |
| } | |
| console.log(getFormattedCard, 'for-loop-with-push') | |
| // map with anonymous function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // data | |
| //for & if | |
| //filter should return | |
| let direction = ["South", "North", "East", "West", "NorthWest", "NorthEast", "SouthWest", "SouthEast"] | |
| let filteredDirection = [] | |
| // | |
| for (let i = 0; i < direction.length; i++) { | |
| if (direction[i].match("West")) { | |
| filteredDirection.push(direction[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let carsNo = ['001', '002', '003', '004'] | |
| let myCarNo; | |
| console.log('--for loop') | |
| for (let i = 0; i < carsNo.length; i++) { | |
| if (carsNo[i] === "002") { | |
| myCarNo = carsNo[i] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // lenght check of each element and return true if any one of them satisfy the conditions | |
| let items = ['001', '00002', '0000003', '002'] | |
| let validatelength = false | |
| console.log('---for loop') | |
| for (let i = 0; i < items.length; i++) { | |
| if (items[i].length > 4) | |
| validatelength = true | |
| } | |
| console.log(validatelength, 'for loop') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // lenght check of each element and return true if all of them satisfy the conditions | |
| let items = ['001', '00002', '0000003', '002'] | |
| let validatelength = false | |
| console.log('---for loop') | |
| for (let i = 0; i < items.length; i++) { | |
| validatelength = items[i].length > 2 | |
| } | |
| console.log(validatelength, 'for loop') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //get email id | |
| let users = [{ | |
| userID: "1", | |
| userEmail: "user1@email.com" | |
| }, | |
| { | |
| userID: "2", | |
| userEmail: "user2@email.com" | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Can implemented all helper using reduce | |
| let number = [10, 20, 30] | |
| let sum = 0; | |
| for (let i = 0; i < number.length; i++) { | |
| sum += number[i]; | |
| } | |
| console.log(sum) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node { | |
| // Check the input build no exits or not | |
| stage('Check the Valid Build Number') { // for display purposes | |
| def jenkins = Jenkins.getInstance() | |
| def jobName = "Demo" | |
| def job = jenkins.getItem(jobName) | |
| def BuildNo = "${BUILD_NUMBER}" | |
| println "Last successfull build: ${job.getLastSuccessfulBuild()}" | |
| def allbuild = "${job.getBuilds().collect{ it.getNumber()}}" |
OlderNewer