Skip to content

Commit 5b842ab

Browse files
authored
Merge pull request trustyai-explainability#20 from adolfo-ab/pr-container-build
fix: pr-container-build workflow
2 parents bfc425d + 3d4c4ef commit 5b842ab

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

.github/workflows/pr-container-build.yaml

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: Build PR LLS Distro Container Image
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
branches: [ main ]
66

77
env:
88
REGISTRY: quay.io
9-
IMAGE_NAME: trustyai_testing/llama-stack-trustyai-fms
9+
ORG: trustyai_testing
10+
IMAGE_NAME: llama-stack-trustyai-fms
1011

1112
jobs:
1213
build-and-push:
@@ -16,23 +17,33 @@ jobs:
1617
packages: write
1718

1819
steps:
20+
- name: Check labels
21+
uses: mheap/github-action-required-labels@v5
22+
with:
23+
mode: minimum
24+
count: 1
25+
labels: "ok-to-test, lgtm, approved"
26+
1927
- name: Checkout repository
2028
uses: actions/checkout@v4
29+
with:
30+
ref: ${{ github.event.pull_request.head.sha }}
2131

2232
- name: Log in to Container Registry
23-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
33+
uses: redhat-actions/podman-login@v1
2434
with:
2535
registry: ${{ env.REGISTRY }}
2636
username: ${{ secrets.QUAY_USERNAME }}
2737
password: ${{ secrets.QUAY_PASSWORD }}
2838

2939
- name: Extract metadata
3040
id: meta
31-
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
41+
uses: docker/metadata-action@v5
3242
with:
33-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
images: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}
3444
tags: |
35-
type=sha,prefix={{branch}}-,format=short
45+
type=ref,event=pr,prefix=pr-
46+
type=sha,format=short
3647
3748
- name: Create temporary build directory
3849
run: |
@@ -41,7 +52,6 @@ jobs:
4152
- name: Copy provider code to build context
4253
run: |
4354
cp -r llama_stack_provider_trustyai_fms/ build-context/
44-
cp -r providers.d/ build-context/
4555
cp run.yaml build-context/
4656
cp pyproject.toml build-context/
4757
@@ -77,28 +87,26 @@ jobs:
7787
# Install the local provider package
7888
RUN pip install -e /opt/app-root/
7989
80-
RUN mkdir -p ${HOME}/.llama/providers.d ${HOME}/.cache
90+
RUN mkdir -p ${HOME}/.cache
8191
COPY run.yaml ${APP_ROOT}/run.yaml
82-
COPY providers.d/ ${HOME}/.llama/providers.d/
8392
8493
ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--config", "/opt/app-root/run.yaml"]
8594
EOF
86-
87-
- name: Create modified provider config
88-
run: |
89-
mkdir -p build-context/providers.d/remote/safety
90-
cat > build-context/providers.d/remote/safety/trustyai_fms.yaml << 'EOF'
91-
adapter:
92-
adapter_type: trustyai_fms
93-
config_class: llama_stack_provider_trustyai_fms.config.FMSSafetyProviderConfig
94-
module: llama_stack_provider_trustyai_fms
95-
api_dependencies: ["safety"]
96-
optional_api_dependencies: ["shields"]
97-
EOF
98-
99-
- name: Build Docker image
100-
uses: docker/build-push-action@55146d969b0dff1a5c12630229609757af5b1081
95+
96+
- name: Build Image
97+
id: build-image
98+
uses: redhat-actions/buildah-build@v2
10199
with:
102-
context: build-context
103-
file: build-context/Containerfile
104-
push: false
100+
image: ${{ env.IMAGE_NAME }}
101+
tags: ${{ steps.meta.outputs.tags }}
102+
containerfiles: |
103+
build-context/Containerfile
104+
105+
- name: Push to Image Registry
106+
uses: redhat-actions/push-to-registry@v2
107+
with:
108+
image: ${{ steps.build-image.outputs.image }}
109+
tags: ${{ steps.build-image.outputs.tags }}
110+
registry: ${{ env.REGISTRY }}/${{ env.ORG }}
111+
username: ${{ secrets.QUAY_USERNAME }}
112+
password: ${{ secrets.QUAY_PASSWORD }}

run.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ providers:
1717
detectors:
1818
regex:
1919
detector_params:
20-
regex: ["email", "ssn", "credit-card", "^verypersonal$"]
21-
external_providers_dir: ./providers.d
20+
regex: ["email", "ssn", "credit-card", "^verypersonal$"]

sourcery.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rule_settings:
2+
disable:
3+
- third-party-action-not-pinned-to-commit-sha

0 commit comments

Comments
 (0)