Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some new code #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
node {
stage('SCM') {
git 'https://github.com/robbiebise/launchpad'
}
stage('SonarQube analysis') {
def scannerHome = tool 'sonar-scanner-cli'; // must match the name of an actual scanner installation directory on your Jenkins build agent
withSonarQubeEnv('SonarQube') {
sh "${scannerHome}/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner"
stage('SCM') {
git 'https://github.com/robbiebise/launchpad'
}
stage('SonarQube analysis') {
def scannerHome = tool 'sonar-scanner-cli'
withSonarQubeEnv('SonarQube') {
if (env.CHANGE_ID) { // Check if this is a PR
sh "${scannerHome}/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} -Dsonar.pullrequest.base=${env.CHANGE_TARGET}"
} else {
sh "${scannerHome}/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner"
}
}
}
}
}
18 changes: 0 additions & 18 deletions ansible/test.py

This file was deleted.

74 changes: 74 additions & 0 deletions docker/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import boto3

def process_data(data):
for item in data:
if item == 'stop':
break
elif item == 'skip':
continue
else:
print(item)

data = ['apple', 'banana', 'skip', 'cherry', 'stop', 'date']
process_data(data)

class DataProcessor:
def __init__(self, data):
self.data = data

def __iter__(self):
for item in self.data:
if item == 'stop':
break
elif item == 'skip':
continue
else:
yield item

data = ['apple', 'banana', 'skip', 'cherry', 'stop', 'date']
processor = DataProcessor(data)
for item in processor:
print(item)


class CustomObject:
def __init__(self, data):
self.data = data

def __contains__(self, item):
return item in self.data

def __not_contains__(self, item):
return item not in self.data

obj = CustomObject(['apple', 'banana', 'cherry'])

if 'apple' in obj:
print('Apple is in the object')

if 'orange' not in obj:
print('Orange is not in the object')


def create_iam_policy(policy_name, policy_document):
iam_client = boto3.client('iam')
response = iam_client.create_policy(
PolicyName=policy_name,
PolicyDocument=policy_document
)
return response['Policy']['Arn']

policy_name = 'UnrestrictedPolicy'
policy_document = {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}

policy_arn = create_iam_policy(policy_name, policy_document)
print(f"Created IAM policy with ARN: {policy_arn}")