@@ -47,36 +47,48 @@ jobs:
47
47
#
48
48
# Print variables for debugging
49
49
- name : Log reference variables
50
+ env :
51
+ GITHUB_REF : ${{ github.ref }}
52
+ GITHUB_HEAD_REF : ${{ github.head_ref }}
53
+ PR_HEAD_SHA : ${{ github.event.pull_request.head.sha }}
54
+ QUAY_RELEASE_REPO : ${{ vars.QUAY_RELEASE_REPO }}
50
55
run : |
51
- echo "CONTEXT: ${{ env. BUILD_CONTEXT }} "
52
- echo "GITHUB.REF: ${{ github.ref }} "
53
- echo "GITHUB.HEAD_REF: ${{ github.head_ref }} "
54
- echo "SHA: ${{ github.event.pull_request.head.sha }} "
55
- echo "MAIN IMAGE AT: ${{ vars. QUAY_RELEASE_REPO }} :latest"
56
- echo "CI IMAGE AT: quay.io/trustyai/guardrails-detector-huggingface-runtime-ci:${{ github.event.pull_request.head.sha }} "
57
- echo "Built-In Detector CI IMAGE AT: quay.io/trustyai/guardrails-detector-built-in-ci:${{ github.event.pull_request.head.sha }} "
58
- echo "LLM Judge CI IMAGE AT: quay.io/trustyai/guardrails-detector-llm-judge-ci:${{ github.event.pull_request.head.sha }} "
56
+ echo "CONTEXT: $BUILD_CONTEXT"
57
+ echo "GITHUB.REF: $GITHUB_REF "
58
+ echo "GITHUB.HEAD_REF: $GITHUB_HEAD_REF "
59
+ echo "SHA: $PR_HEAD_SHA "
60
+ echo "MAIN IMAGE AT: $QUAY_RELEASE_REPO:latest"
61
+ echo "CI IMAGE AT: quay.io/trustyai/guardrails-detector-huggingface-runtime-ci:$PR_HEAD_SHA "
62
+ echo "Built-In Detector CI IMAGE AT: quay.io/trustyai/guardrails-detector-built-in-ci:$PR_HEAD_SHA "
63
+ echo "LLM Judge CI IMAGE AT: quay.io/trustyai/guardrails-detector-llm-judge-ci:$PR_HEAD_SHA "
59
64
60
65
# Set environments depending on context
61
66
- name : Set CI environment
62
67
if : env.BUILD_CONTEXT == 'ci'
68
+ env :
69
+ PR_HEAD_SHA : ${{ github.event.pull_request.head.sha }}
63
70
run : |
64
- echo "TAG=${{ github.event.pull_request.head.sha }} " >> $GITHUB_ENV
71
+ echo "TAG=$PR_HEAD_SHA " >> $GITHUB_ENV
65
72
echo "IMAGE_NAME=quay.io/trustyai/guardrails-detector-huggingface-runtime-ci" >> $GITHUB_ENV
66
73
echo "BUILTIN_IMAGE_NAME=quay.io/trustyai/guardrails-detector-built-in-ci" >> $GITHUB_ENV
67
74
echo "LLM_JUDGE_IMAGE_NAME=quay.io/trustyai/guardrails-detector-llm-judge-ci" >> $GITHUB_ENV
68
75
- name : Set main-branch environment
69
76
if : env.BUILD_CONTEXT == 'main'
77
+ env :
78
+ QUAY_RELEASE_REPO : ${{ vars.QUAY_RELEASE_REPO }}
70
79
run : |
71
80
echo "TAG=latest" >> $GITHUB_ENV
72
- echo "IMAGE_NAME=${{ vars. QUAY_RELEASE_REPO }} " >> $GITHUB_ENV
81
+ echo "IMAGE_NAME=$QUAY_RELEASE_REPO" >> $GITHUB_ENV
73
82
echo "BUILTIN_IMAGE_NAME=quay.io/trustyai/guardrails-detector-built-in" >> $GITHUB_ENV
74
83
echo "LLM_JUDGE_IMAGE_NAME=quay.io/trustyai/guardrails-detector-llm-judge" >> $GITHUB_ENV
75
84
- name : Set tag environment
76
85
if : env.BUILD_CONTEXT == 'tag'
86
+ env :
87
+ GITHUB_REF_NAME : ${{ github.ref_name }}
88
+ QUAY_RELEASE_REPO : ${{ vars.QUAY_RELEASE_REPO }}
77
89
run : |
78
- echo "TAG=${{ github.ref_name }} " >> $GITHUB_ENV
79
- echo "IMAGE_NAME=${{ vars. QUAY_RELEASE_REPO }} " >> $GITHUB_ENV
90
+ echo "TAG=$GITHUB_REF_NAME " >> $GITHUB_ENV
91
+ echo "IMAGE_NAME=$QUAY_RELEASE_REPO" >> $GITHUB_ENV
80
92
echo "BUILTIN_IMAGE_NAME=quay.io/trustyai/guardrails-detector-built-in" >> $GITHUB_ENV
81
93
echo "LLM_JUDGE_IMAGE_NAME=quay.io/trustyai/guardrails-detector-llm-judge" >> $GITHUB_ENV
82
94
#
@@ -88,19 +100,22 @@ jobs:
88
100
echo 'LABEL quay.expires-after=7d#' >> detectors/Dockerfile.builtIn
89
101
echo 'LABEL quay.expires-after=7d#' >> detectors/Dockerfile.judge
90
102
- name : Build image
91
- run : docker build -t ${{ env. IMAGE_NAME }} :$TAG -f detectors/Dockerfile.hf detectors
103
+ run : docker build -t "$ IMAGE_NAME:$TAG" -f detectors/Dockerfile.hf detectors
92
104
- name : Log in to Quay
93
- run : docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} -p ${{ secrets.QUAY_ROBOT_SECRET }} quay.io
105
+ env :
106
+ QUAY_ROBOT_USERNAME : ${{ secrets.QUAY_ROBOT_USERNAME }}
107
+ QUAY_ROBOT_SECRET : ${{ secrets.QUAY_ROBOT_SECRET }}
108
+ run : docker login -u "$QUAY_ROBOT_USERNAME" -p "$QUAY_ROBOT_SECRET" quay.io
94
109
- name : Push to Quay CI repo
95
- run : docker push ${{ env. IMAGE_NAME }} :$TAG
110
+ run : docker push "$ IMAGE_NAME:$TAG"
96
111
- name : Build built-in detector image
97
- run : docker build -t ${{ env. BUILTIN_IMAGE_NAME }} :$TAG -f detectors/Dockerfile.builtIn detectors
112
+ run : docker build -t "$ BUILTIN_IMAGE_NAME:$TAG" -f detectors/Dockerfile.builtIn detectors
98
113
- name : Push to Quay CI repo
99
- run : docker push ${{ env. BUILTIN_IMAGE_NAME }} :$TAG
114
+ run : docker push "$ BUILTIN_IMAGE_NAME:$TAG"
100
115
- name : Build LLM Judge detector image
101
- run : docker build -t ${{ env. LLM_JUDGE_IMAGE_NAME }} :$TAG -f detectors/Dockerfile.judge detectors
116
+ run : docker build -t "$ LLM_JUDGE_IMAGE_NAME:$TAG" -f detectors/Dockerfile.judge detectors
102
117
- name : Push LLM Judge image to Quay CI repo
103
- run : docker push ${{ env. LLM_JUDGE_IMAGE_NAME }} :$TAG
118
+ run : docker push "$ LLM_JUDGE_IMAGE_NAME:$TAG"
104
119
# Leave comment
105
120
- uses : peter-evans/find-comment@v3
106
121
name : Find Comment
@@ -113,16 +128,18 @@ jobs:
113
128
- uses : peter-evans/create-or-update-comment@v4
114
129
if : env.BUILD_CONTEXT == 'ci'
115
130
name : Generate/update success message comment
131
+ env :
132
+ PR_HEAD_SHA : ${{ github.event.pull_request.head.sha }}
116
133
with :
117
134
comment-id : ${{ steps.fc.outputs.comment-id }}
118
135
issue-number : ${{ github.event.pull_request.number }}
119
136
edit-mode : replace
120
137
body : |
121
138
PR image build completed successfully!
122
139
123
- 📦 [PR image](https://quay.io/repository/trustyai/guardrails-detector-huggingface-runtime-ci?tab=tags): `quay.io/trustyai/guardrails-detector-huggingface-runtime-ci:${{ github.event.pull_request.head.sha }} `
124
- 📦 [PR image](https://quay.io/trustyai/guardrails-detector-built-in-ci?tab=tags): `quay.io/trustyai/guardrails-detector-built-in-ci:${{ github.event.pull_request.head.sha }} `
125
- 📦 [PR image](https://quay.io/trustyai/guardrails-detector-llm-judge-ci?tab=tags): `quay.io/trustyai/guardrails-detector-llm-judge-ci:${{ github.event.pull_request.head.sha }} `
140
+ 📦 [PR image](https://quay.io/repository/trustyai/guardrails-detector-huggingface-runtime-ci?tab=tags): `quay.io/trustyai/guardrails-detector-huggingface-runtime-ci:$PR_HEAD_SHA `
141
+ 📦 [PR image](https://quay.io/trustyai/guardrails-detector-built-in-ci?tab=tags): `quay.io/trustyai/guardrails-detector-built-in-ci:$PR_HEAD_SHA `
142
+ 📦 [PR image](https://quay.io/trustyai/guardrails-detector-llm-judge-ci?tab=tags): `quay.io/trustyai/guardrails-detector-llm-judge-ci:$PR_HEAD_SHA `
126
143
- name : Trivy scan
127
144
uses :
aquasecurity/[email protected]
128
145
with :
0 commit comments