Skip to content

Commit 4159d70

Browse files
committed
try with CI approach
1 parent 461ed1a commit 4159d70

File tree

2 files changed

+9
-33
lines changed

2 files changed

+9
-33
lines changed

.github/workflows/framework-build-cache.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
LOKI_TENANT_ID: promtail
1212
LOKI_URL: http://localhost:3030/loki/api/v1/push
1313
DOCKER_BUILDKIT: 1
14-
DOCKER_CLI_EXPERIMENTAL: enabled
14+
CTF_CHAINLINK_IMAGE: chainlink-local-image:latest
1515
runs-on: ubuntu-latest
1616
permissions:
1717
id-token: write
@@ -52,11 +52,13 @@ jobs:
5252
path: chainlink-repo
5353
- name: Set up Docker Buildx
5454
uses: docker/setup-buildx-action@v2
55-
- name: Set up Environment Variables
56-
run: |
57-
echo "GITHUB_SERVER_URL=${{ github.server_url }}" >> $GITHUB_ENV
58-
echo "GITHUB_REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV
59-
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
55+
- name: Build and Load Docker Image
56+
uses: docker/build-push-action@v4
57+
with:
58+
context: /home/runner/work/chainlink-testing-framework/chainlink-testing-framework/chainlink-repo
59+
file: /home/runner/work/chainlink-testing-framework/chainlink-testing-framework/chainlink-repo/plugins/chainlink.Dockerfile
60+
load: true
61+
tags: ${{ env.CTF_CHAINLINK_IMAGE }}
6062
- name: Run System Tests
6163
env:
6264
CTF_CONFIGS: ${{ matrix.test.config }}

framework/docker.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -267,33 +267,7 @@ func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string) error {
267267
var err error
268268
once.Do(func() {
269269
dfilePath := filepath.Join(dctx, dfile)
270-
271-
githubServerURL := os.Getenv("GITHUB_SERVER_URL")
272-
githubRepository := os.Getenv("GITHUB_REPOSITORY")
273-
githubToken := os.Getenv("GITHUB_TOKEN")
274-
275-
if githubServerURL == "" || githubRepository == "" || githubToken == "" {
276-
L.Fatal().Err(err).Msg("Required environment variables are missing: GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_TOKEN")
277-
return
278-
}
279-
280-
// Construct the cache URL
281-
cacheURL := fmt.Sprintf("%s/%s", githubServerURL, githubRepository)
282-
err = runCommand(
283-
"docker",
284-
"buildx",
285-
"build",
286-
"--load",
287-
"--cache-from",
288-
fmt.Sprintf("type=gha,url=%s,token=%s,scope=ctfdocker", cacheURL, githubToken),
289-
"--cache-to",
290-
fmt.Sprintf("type=gha,url=%s,token=%s,scope=ctfdocker,mode=max", cacheURL, githubToken),
291-
"-t",
292-
nameAndTag,
293-
"-f",
294-
dfilePath,
295-
dctx,
296-
)
270+
err = runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx)
297271
if err != nil {
298272
err = fmt.Errorf("failed to build Docker image: %w", err)
299273
}

0 commit comments

Comments
 (0)