Skip to content
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
53 changes: 53 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
pipeline {
agent any

environment {
APIGEE_ORG = 'blissful-axiom-358022'
APIGEE_ENV = 'eval'
APIGEE_API = 'notifications'
APIGEE_BASE_URL = 'https://api.enterprise.apigee.com/v1'
}

stages {
stage('Checkout') {
steps {
git branch: 'feature/deploy-com-jenkins', url: 'https://github.com/GilbertoJNJ/apigee-notification-api.git'
}
}

stage('Build Proxy') {
steps {
dir('src/main/apigee/apiproxies/notification-api') {
bat 'tar -cvf notifications.zip apiproxy/*'
}
}
}

stage('Deploy Proxy') {
steps {
script {
withCredentials([usernamePassword(credentialsId: 'apigee-credentials', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
bat '''
curl -X POST "$APIGEE_BASE_URL/organizations/$APIGEE_ORG/apis?action=import&name=$APIGEE_API" \
-u $USERNAME:$PASSWORD \
-F "file=@src/main/apigee/apiproxies/notification-api/notifications.zip" \
-F "name=$APIGEE_API"

curl -X POST "$APIGEE_BASE_URL/organizations/$APIGEE_ORG/environments/$APIGEE_ENV/apis/$APIGEE_API/revisions/1/deployments" \
-u $USERNAME:$PASSWORD
'''
}
}
}
}
}

post {
success {
echo 'Proxy successfully deployed!'
}
failure {
echo 'Proxy deployment failed.'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<APIProxy name="notifications">
<Description>API de notificações</Description>
<CreatedAt>2024-10-19T00:00:00Z</CreatedAt>
<CreatedBy>user@example.com</CreatedBy>
<LastModifiedAt>2024-10-19T00:00:00Z</LastModifiedAt>
<LastModifiedBy>user@example.com</LastModifiedBy>
<Revision>1</Revision>
<BasePaths>
<BasePath>/notifications</BasePath>
</BasePaths>
<ContextInfo revision="1">
<ContextVariable name="organization" value="your-apigee-org"/>
</ContextInfo>
<Resources/>
</APIProxy>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<TargetEndpoint name="backend">
<HTTPTargetConnection>
<URL>http://{api-url}/notifications</URL>
<URL>https://mocktarget.apigee.net</URL>
</HTTPTargetConnection>
</TargetEndpoint>