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
| var ApiBuilder = require('claudia-api-builder'), | |
| AWS = require('aws-sdk'), | |
| dateFormat = require('dateformat'), | |
| Slack = require('slack-node'), | |
| api = new ApiBuilder(); | |
| // initial input from user | |
| api.post('/cockpit/accessrequest', async function(request) { | |
| let ip = request.post.text; | |
| return selection(ip); |
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
| // handle both ip4 and ip6 | |
| let ipv4regex = /(?<=`)[\d.]+(?=`)/; | |
| let ipv6regex = /(?<=`)(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(?=`)/; | |
| function ipAddress(input) { | |
| ip = null; | |
| let ip4result = ipv4regex.exec(input); | |
| if (ip4result != null) { | |
| ip = ip4result[0]; | |
| } else { |
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
| function updateSecurityGroups(ip, username) { | |
| return function (groups) { | |
| // remove rules | |
| removals = groups.filter(g => g.IpPermissions.filter(i => i.IpRanges.filter(r => r['Description'] == username).length > 0).length > 0); | |
| console.log(`${username} has ${removals.length} current groups they need removing from`); | |
| removals.forEach(function(element) { | |
| cidrRemovals = element.IpPermissions.map(r => r.IpRanges.filter(x => x['Description'] == username).map(function(x) { return { CidrIp: x.CidrIp }}))[0] | |
| port = element.Tags.find(e => e['Key'] == 'cockpit-port')['Value']; | |
| sgId = element.GroupId; | |
| console.log(`${username} has a rule in ${sgId} that will be removed`); |
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
| FROM jenkins/jenkins:lts-alpine | |
| USER root | |
| RUN apk update | |
| RUN apk add --no-cache python2 py-setuptools shadow groff less py-pip | |
| RUN pip install --upgrade pip | |
| RUN pip install awscli | |
| RUN pip install virtualenv | |
| RUN apk add docker |
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
| workflow-aggregator:2.5 | |
| timestamper:1.8.8 | |
| role-strategy:2.5.1 | |
| ssh-slaves:1.20 | |
| antisamy-markup-formatter:1.5 | |
| extra-columns:1.18 | |
| job-dsl:1.69 | |
| git-client:2.7.0 | |
| github:1.29.2 | |
| github-branch-source:2.3.6 |
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
| #!/usr/bin/env groovy | |
| import java.util.logging.Logger | |
| import jenkins.model.Jenkins | |
| import hudson.model.* | |
| import hudson.markup.RawHtmlMarkupFormatter | |
| import javaposse.jobdsl.dsl.DslScriptLoader | |
| import javaposse.jobdsl.plugin.JenkinsJobManagement | |
| import com.cloudbees.plugins.credentials.* | |
| import com.cloudbees.plugins.credentials.common.* |
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
| #!/usr/bin/env groovy | |
| pipeline { | |
| agent any | |
| stages { | |
| stage('Build Docker Images') { | |
| steps { | |
| dir ("docker/buildbase") { | |
| sh ('docker build --rm -t buildbase .') | |
| } | |
| dir ("docker/builder") { |
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
| #!/usr/bin/env sh | |
| pwd | |
| echo "running pytest at top level" | |
| rm -rf .pytest_cache | |
| python -m pytest example-tests --basetemp=/tmp -p no:cacheprovider '--junit-xml=build/test-results.xml' | |
| chown -R 1000:1000 . |
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
| AWSTemplateFormatVersion: "2010-09-09" | |
| Description: Creates Persistance storage for jenkins in the build environmentName | |
| Parameters: | |
| BuildStack: | |
| Description: The stack this volume relates to. | |
| Type: String | |
| SnapshotId: | |
| Description: The snap shot to build the volume from. |
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
| #!/usr/bin/env sh | |
| CONTAINER_NAME=$1 | |
| echo "removing containers: $CONTAINER_NAME" | |
| docker rm $(docker ps -a | grep "$CONTAINER_NAME" | awk '{print $1}') ||: | |
| echo "removing images associated with: $CONTAINER_NAME" | |
| docker rmi $(docker images -a | grep "$CONTAINER_NAME" | awk '{print $3}') -f ||: |
OlderNewer