Skip to content

Commit

Permalink
Fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangpengcheng committed May 15, 2024
1 parent 1dda6a2 commit 3527bdd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 63 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,62 +119,3 @@ jobs:
image-ref: 'pulsar-functions-pulsarctl-go-runner:latest'
format: 'table'
exit-code: '0'

# Comment on PR with the scan output since the action won't fail with CVEs
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const uniqueIdentifier = '#Runner Images Scan Result:';
// Function to get output from a file
function getOutput(stepId) {
const outputFile = path.join(process.env.GITHUB_WORKSPACE, `${stepId}_output.txt`);
if (fs.existsSync(outputFile)) {
return fs.readFileSync(outputFile, 'utf8');
}
return ''; // Return empty string if file does not exist
}
// Combine outputs from different steps
const outputs = [
{ label: 'Java Runner', output: '${{ steps.scan-java-runner.outputs.result }}' },
{ label: 'Python Runner', output: '${{ steps.scan-python-runner.outputs.result }}' },
{ label: 'Go Runner', output: '${{ steps.scan-go-runner.outputs.result }}' },
{ label: 'Java Runner with Pulsarctl', output: '${{ steps.scan-java-pulsarctl-runner.outputs.result }}' },
{ label: 'Python Runner with Pulsarctl', output: '${{ steps.scan-python-pulsarctl-runner.outputs.result }}' },
{ label: 'Go Runner with Pulsarctl', output: '${{ steps.scan-go-pulsarctl-runner.outputs.result }}' },
].filter(item => item.output !== '');
// Format the combined message
let combinedMessage = outputs.map(item => `**${item.label} Vulnerabilities:**\n\`\`\`\n${item.output}\n\`\`\``).join('\n\n');
combinedMessage = `${uniqueIdentifier}\n\n` + combinedMessage; // Add unique identifier to the message
const issue_number = context.issue.number;
const { data: comments } = await github.rest.issues.listComments({
...context.repo,
issue_number: issue_number,
});
// Find existing comment
const existingComment = comments.find(comment => comment.body.includes(uniqueIdentifier));
// Update or create comment
if (existingComment) {
await github.rest.issues.updateComment({
...context.repo,
comment_id: existingComment.id,
body: combinedMessage
});
} else {
await github.rest.issues.createComment({
...context.repo,
issue_number: issue_number,
body: combinedMessage
});
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1 change: 0 additions & 1 deletion images/pulsar-functions-java-runner/pulsarctl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN echo "VERSION_TAG=${VERSION_TAG}" && \
apk update && apk add --no-cache $JRE_PACKAGE_NAME

COPY --from=pulsar --chown=$UID:$GID /pulsar/conf /pulsar/conf
COPY --from=pulsar --chown=$UID:$GID /pulsar/bin /pulsar/bin
COPY --from=pulsar --chown=$UID:$GID /pulsar/lib /pulsar/lib
COPY --from=pulsar --chown=$UID:$GID /pulsar/instances/java-instance.jar /pulsar/instances/java-instance.jar
COPY --from=pulsar --chown=$UID:$GID /pulsar/instances/deps /pulsar/instances/deps
Expand Down
3 changes: 1 addition & 2 deletions images/pulsar-functions-python-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ RUN python3 get-pip.py

WORKDIR /pulsar

RUN if [ -f "/pulsar/bin/install-pulsar-client-37.sh" ]; then /pulsar/bin/install-pulsar-client-37.sh || true ; fi
RUN if [ -f "/pulsar/bin/install-pulsar-client.sh" ]; then /pulsar/bin/install-pulsar-client.sh || pip3 install 'pulsar-client[all]==3.5.0' ; fi
RUN pip3 install 'pulsar-client[all]==3.5.0'

# this dir is duplicate with the installed pulsar-client pip package, and maybe not compatible with the `_pulsar`(the .so library package)
RUN rm -rf /pulsar/instances/python-instance/pulsar/ \
Expand Down
2 changes: 1 addition & 1 deletion images/pulsar-functions-python-runner/pulsarctl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ARG PULSAR_IMAGE_TAG
FROM ${PULSAR_IMAGE}:${PULSAR_IMAGE_TAG} as pulsar
FROM pulsar-functions-pulsarctl-runner-base:latest

COPY --from=pulsar --chown=$UID:$GID /pulsar/bin /pulsar/bin
COPY --from=pulsar --chown=$UID:$GID /pulsar/instances/python-instance /pulsar/instances/python-instance
# Pulsar 2.11.0 removes /pulsar/pulsar-client from docker image
# But it required with Pulsar 2.10.X and below
Expand All @@ -26,6 +25,7 @@ RUN apk update \

RUN if [ -f "/pulsar/bin/install-pulsar-client-37.sh" ]; then /pulsar/bin/install-pulsar-client-37.sh || pip3 install 'pulsar-client[all]==3.5.0' ; fi
RUN if [ -f "/pulsar/bin/install-pulsar-client.sh" ]; then /pulsar/bin/install-pulsar-client.sh || pip3 install 'pulsar-client[all]==3.5.0' ; fi
RUN pip3 install 'pulsar-client[all]==3.5.0'

# this dir is duplicate with the installed pulsar-client pip package, and maybe not compatible with the `_pulsar`(the .so library package)
RUN rm -rf /pulsar/instances/python-instance/pulsar/ \
Expand Down

0 comments on commit 3527bdd

Please sign in to comment.