Skip to content

Commit

Permalink
Taps
Browse files Browse the repository at this point in the history
Signed-off-by: Sophia Guo <[email protected]>
  • Loading branch information
sophia-guo committed Jun 19, 2024
1 parent 1eae88f commit c7a115d
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
Empty file added .github/workflows/upload.yml
Empty file.
64 changes: 64 additions & 0 deletions buildenv/jenkins/tapVerification/JenkinsFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pipeline {
agent { label 'ci.role.test&&hw.arch.x86&&sw.os.linux' }
environment {
GITHUB_TOKEN = credentials('')
REPO_OWNER = 'sophia-guo'
REPO_NAME = 'openjdk-tests'
ISSUE_NUMBER = "https://github.com/adoptium/aqa-tests/issues/5235"
DOWNLOAD_DIR ='download'
}
stages {
stage('Download Attachments') {
steps {
script {
def issueUrl = "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/issues/${ISSUE_NUMBER}"
def attachmentsDir = new File(DOWNLOAD_DIR)

if (!attachmentsDir.exists()) {
attachmentsDir.mkdirs()
}

def response = httpRequest (
url: issueUrl,
customHeaders: [[name: 'Authorization', value: "token ${env.GITHUB_TOKEN}"]],
acceptType: 'APPLICATION_JSON'
)

def issue = readJSON(text: response.content)
def commentsUrl = issue.comments_url

def commentsResponse = httpRequest (
url: commentsUrl,
customHeaders: [[name: 'Authorization', value: "token ${env.GITHUB_TOKEN}"]],
acceptType: 'APPLICATION_JSON'
)

def comments = readJSON(text: commentsResponse.content)
comments.each { comment ->
def body = comment.body
def attachments = body.findAll(/https:\/\/.+\.txt/)

attachments.each { attachmentUrl ->
def fileName = attachmentUrl.tokenize('/').last()
if (fileName.endsWith('.txt')) {
echo "Downloading ${attachmentUrl}"
def fileContent = httpRequest (
url: attachmentUrl,
customHeaders: [[name: 'Authorization', value: "token ${env.GITHUB_TOKEN}"]],
acceptType: 'APPLICATION_OCTETSTREAM'
).content
writeFile file: "${DOWNLOAD_DIR}/${fileName}", text: fileContent
}
}
}
}
}
}
}

post {
always {
archiveArtifacts artifacts: "${DOWNLOAD_DIR}/*.tap.txt", allowEmptyArchive: true
cleanWs()
}
}
45 changes: 45 additions & 0 deletions buildenv/jenkins/tapVerification/JenkinsFile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
pipeline {
agent { label 'ci.role.test&&hw.arch.x86&&sw.os.linux' }
parameters {
string(name: 'FILE_URL', defaultValue: '', description: 'URL to the uploaded artifacts')
string(name: 'Release_PipelineJob_Name', defaultValue: '', description: 'Jenkins Pipeline job name')
string(name: 'Release_PipelineJob_Number', defaultValue: '', description: 'Jenkins Pipeline job number')
}
stages {
stage('Download and archive Artifacts') {
steps {
def tarDir = 'AQAvitTaps'
def tarTap = 'AQAvitTapFiles.tar.gz'
timeout(time: 1, unit: 'HOURS') {
try {
copyArtifacts (projectName: "${Release_PipelineJob_Name}",
selector: specific("${Release_PipelineJob_Number}"),
filter: '${tarDir}/${tarTap}',
target: "${tarDir}/"
} catch (Exception e) {
echo 'Exception: ' + e.toString()
echo "Cannot copy AQAvitTaps/AQAvitTapFiles.tar.gz from ${Release_PipelineJob_Name} with build id ${Release_PipelineJob_Number} . Skipping copyArtifacts..."
}
}
script {

def fileUrl = params.FILE_URL
def fileName = "Grinder.tar.gz"
sh """
cd ${tarDir}/
curl -L -o ${fileName} ${fileUrl}
//untar Grinder.tar.gz
//untar AQAvitTapFiles.tar.gz
//tar new AQAvitTapFiles.tar.gz
"""
}
}
}
}
post {
always {
archiveArtifacts artifacts: "${tarDir}/${tarTap}", allowEmptyArchive: true
cleanWs()
}
}
}

0 comments on commit c7a115d

Please sign in to comment.