|
1 |
| -name: Create Docker image for local testing |
2 |
| - |
3 |
| -on: |
4 |
| - pull_request: |
5 |
| - types: [opened, reopened, synchronize] |
6 |
| - branches: |
7 |
| - - main |
8 |
| - |
9 |
| -permissions: |
10 |
| - pull-requests: write |
11 |
| - issues: write |
12 |
| - |
13 |
| -jobs: |
14 |
| - build: |
15 |
| - name: Build and archive plugin build artifacts |
16 |
| - runs-on: ubuntu-latest |
17 |
| - strategy: |
18 |
| - fail-fast: true |
19 |
| - |
20 |
| - steps: |
21 |
| - - uses: actions/checkout@v4 |
22 |
| - |
23 |
| - - name: Setup Node.js environment |
24 |
| - |
25 |
| - with: |
26 |
| - node-version-file: '.nvmrc' |
27 |
| - |
28 |
| - - name: Install Go environment |
29 |
| - uses: actions/setup-go@v5 |
30 |
| - with: |
31 |
| - go-version: 'stable' |
32 |
| - |
33 |
| - - name: Install yarn dependencies |
34 |
| - run: yarn install |
35 |
| - env: |
36 |
| - NODE_OPTIONS: '--max_old_space_size=4096' |
37 |
| - |
38 |
| - - name: Build |
39 |
| - run: go build -v ./... |
40 |
| - |
41 |
| - - name: Build Frontend |
42 |
| - run: yarn build |
43 |
| - env: |
44 |
| - NODE_OPTIONS: '--max_old_space_size=4096' |
45 |
| - |
46 |
| - - name: Archive plugin build artifacts |
47 |
| - uses: actions/upload-artifact@v4 |
48 |
| - with: |
49 |
| - name: plugin-dist |
50 |
| - path: | |
51 |
| - dist |
52 |
| - retention-days: 1 |
53 |
| - push_to_registry: |
54 |
| - name: Push Docker image to Docker Hub |
55 |
| - runs-on: ubuntu-latest |
56 |
| - needs: build |
57 |
| - steps: |
58 |
| - - name: Download plugin build artifacts |
59 |
| - uses: actions/download-artifact@v4 |
60 |
| - id: download |
61 |
| - with: |
62 |
| - name: plugin-dist |
63 |
| - |
64 |
| - - name: Generate Dockerfile |
65 |
| - shell: bash |
66 |
| - run: | |
67 |
| - echo "FROM grafana/grafana-oss:latest |
68 |
| -
|
69 |
| - # Make it as simple as possible to access the grafana instance for development purposes |
70 |
| - # Do NOT enable these settings in a public facing / production grafana instance |
71 |
| - ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" |
72 |
| - ENV GF_AUTH_ANONYMOUS_ENABLED "true" |
73 |
| - ENV GF_AUTH_BASIC_ENABLED "false" |
74 |
| -
|
75 |
| - # Set development mode so plugins can be loaded without the need to sign |
76 |
| - ENV GF_DEFAULT_APP_MODE "development" |
77 |
| -
|
78 |
| - # TODO: Cleanup script should remove images from closed PRs using these labels |
79 |
| - LABEL gh-sha="${{ github.event.pull_request.head.sha }}" |
80 |
| - LABEL gh-repo="${{ github.event.repository.name }}" |
81 |
| - LABEL gh-pr-number="${{ github.event.number }}" |
82 |
| -
|
83 |
| - # Copy plugin build artifacts into the image |
84 |
| - COPY . /var/lib/grafana/plugins/${{ github.event.repository.name }}/" > Dockerfile |
85 |
| -
|
86 |
| - - name: Log in to Docker Hub |
87 |
| - uses: docker/login-action@v3 |
88 |
| - with: |
89 |
| - username: ${{ secrets.DOCKERHUB_USERNAME }} |
90 |
| - password: ${{ secrets.DOCKERHUB_TOKEN }} |
91 |
| - |
92 |
| - - name: Build and push Docker image |
93 |
| - uses: docker/build-push-action@v5 |
94 |
| - with: |
95 |
| - context: . |
96 |
| - file: ./Dockerfile |
97 |
| - push: true |
98 |
| - tags: grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre |
99 |
| - add_pr_comment: |
100 |
| - name: Add PR comment |
101 |
| - runs-on: ubuntu-latest |
102 |
| - needs: push_to_registry |
103 |
| - steps: |
104 |
| - - name: Find previous comment (if any) |
105 |
| - uses: peter-evans/find-comment@v2 |
106 |
| - id: fc |
107 |
| - with: |
108 |
| - issue-number: ${{ github.event.number }} |
109 |
| - body-includes: Use the following command to run this PR with Docker |
110 |
| - - name: Update comment on PR |
111 |
| - if: steps.fc.outputs.comment-id != '' |
112 |
| - uses: peter-evans/create-or-update-comment@v3 |
113 |
| - with: |
114 |
| - comment-id: ${{ steps.fc.outputs.comment-id }} |
115 |
| - edit-mode: replace |
116 |
| - issue-number: ${{ github.event.number }} |
117 |
| - body: | |
118 |
| - Use the following command to run this PR with Docker at http://localhost:3000: |
119 |
| -
|
120 |
| - ``` |
121 |
| - docker run --rm -p 3000:3000 grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre |
122 |
| - ``` |
123 |
| - - name: Add comment to PR |
124 |
| - if: steps.fc.outputs.comment-id == '' |
125 |
| - uses: peter-evans/create-or-update-comment@v3 |
126 |
| - with: |
127 |
| - issue-number: ${{ github.event.number }} |
128 |
| - body: | |
129 |
| - Use the following command to run this PR with Docker at http://localhost:3000: |
130 |
| -
|
131 |
| - ``` |
132 |
| - docker run --rm -p 3000:3000 grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre |
133 |
| - ``` |
| 1 | +#name: Create Docker image for local testing |
| 2 | +# |
| 3 | +#on: |
| 4 | +# pull_request: |
| 5 | +# types: [opened, reopened, synchronize] |
| 6 | +# branches: |
| 7 | +# - main |
| 8 | +# |
| 9 | +#permissions: |
| 10 | +# pull-requests: write |
| 11 | +# issues: write |
| 12 | +# |
| 13 | +#jobs: |
| 14 | +# build: |
| 15 | +# name: Build and archive plugin build artifacts |
| 16 | +# runs-on: ubuntu-latest |
| 17 | +# strategy: |
| 18 | +# fail-fast: true |
| 19 | +# |
| 20 | +# steps: |
| 21 | +# - uses: actions/checkout@v4 |
| 22 | +# |
| 23 | +# - name: Setup Node.js environment |
| 24 | + |
| 25 | +# with: |
| 26 | +# node-version-file: '.nvmrc' |
| 27 | +# |
| 28 | +# - name: Install Go environment |
| 29 | +# uses: actions/setup-go@v5 |
| 30 | +# with: |
| 31 | +# go-version: 'stable' |
| 32 | +# |
| 33 | +# - name: Install yarn dependencies |
| 34 | +# run: yarn install |
| 35 | +# env: |
| 36 | +# NODE_OPTIONS: '--max_old_space_size=4096' |
| 37 | +# |
| 38 | +# - name: Build |
| 39 | +# run: go build -v ./... |
| 40 | +# |
| 41 | +# - name: Build Frontend |
| 42 | +# run: yarn build |
| 43 | +# env: |
| 44 | +# NODE_OPTIONS: '--max_old_space_size=4096' |
| 45 | +# |
| 46 | +# - name: Archive plugin build artifacts |
| 47 | +# uses: actions/upload-artifact@v4 |
| 48 | +# with: |
| 49 | +# name: plugin-dist |
| 50 | +# path: | |
| 51 | +# dist |
| 52 | +# retention-days: 1 |
| 53 | +# push_to_registry: |
| 54 | +# name: Push Docker image to Docker Hub |
| 55 | +# runs-on: ubuntu-latest |
| 56 | +# needs: build |
| 57 | +# steps: |
| 58 | +# - name: Download plugin build artifacts |
| 59 | +# uses: actions/download-artifact@v4 |
| 60 | +# id: download |
| 61 | +# with: |
| 62 | +# name: plugin-dist |
| 63 | +# |
| 64 | +# - name: Generate Dockerfile |
| 65 | +# shell: bash |
| 66 | +# run: | |
| 67 | +# echo "FROM grafana/grafana-oss:latest |
| 68 | +# |
| 69 | +# # Make it as simple as possible to access the grafana instance for development purposes |
| 70 | +# # Do NOT enable these settings in a public facing / production grafana instance |
| 71 | +# ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" |
| 72 | +# ENV GF_AUTH_ANONYMOUS_ENABLED "true" |
| 73 | +# ENV GF_AUTH_BASIC_ENABLED "false" |
| 74 | +# |
| 75 | +# # Set development mode so plugins can be loaded without the need to sign |
| 76 | +# ENV GF_DEFAULT_APP_MODE "development" |
| 77 | +# |
| 78 | +# # TODO: Cleanup script should remove images from closed PRs using these labels |
| 79 | +# LABEL gh-sha="${{ github.event.pull_request.head.sha }}" |
| 80 | +# LABEL gh-repo="${{ github.event.repository.name }}" |
| 81 | +# LABEL gh-pr-number="${{ github.event.number }}" |
| 82 | +# |
| 83 | +# # Copy plugin build artifacts into the image |
| 84 | +# COPY . /var/lib/grafana/plugins/${{ github.event.repository.name }}/" > Dockerfile |
| 85 | +# |
| 86 | +# - name: Log in to Docker Hub |
| 87 | +# uses: docker/login-action@v3 |
| 88 | +# with: |
| 89 | +# username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 90 | +# password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 91 | +# |
| 92 | +# - name: Build and push Docker image |
| 93 | +# uses: docker/build-push-action@v5 |
| 94 | +# with: |
| 95 | +# context: . |
| 96 | +# file: ./Dockerfile |
| 97 | +# push: true |
| 98 | +# tags: grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre |
| 99 | +# add_pr_comment: |
| 100 | +# name: Add PR comment |
| 101 | +# runs-on: ubuntu-latest |
| 102 | +# needs: push_to_registry |
| 103 | +# steps: |
| 104 | +# - name: Find previous comment (if any) |
| 105 | +# uses: peter-evans/find-comment@v2 |
| 106 | +# id: fc |
| 107 | +# with: |
| 108 | +# issue-number: ${{ github.event.number }} |
| 109 | +# body-includes: Use the following command to run this PR with Docker |
| 110 | +# - name: Update comment on PR |
| 111 | +# if: steps.fc.outputs.comment-id != '' |
| 112 | +# uses: peter-evans/create-or-update-comment@v3 |
| 113 | +# with: |
| 114 | +# comment-id: ${{ steps.fc.outputs.comment-id }} |
| 115 | +# edit-mode: replace |
| 116 | +# issue-number: ${{ github.event.number }} |
| 117 | +# body: | |
| 118 | +# Use the following command to run this PR with Docker at http://localhost:3000: |
| 119 | +# |
| 120 | +# ``` |
| 121 | +# docker run --rm -p 3000:3000 grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre |
| 122 | +# ``` |
| 123 | +# - name: Add comment to PR |
| 124 | +# if: steps.fc.outputs.comment-id == '' |
| 125 | +# uses: peter-evans/create-or-update-comment@v3 |
| 126 | +# with: |
| 127 | +# issue-number: ${{ github.event.number }} |
| 128 | +# body: | |
| 129 | +# Use the following command to run this PR with Docker at http://localhost:3000: |
| 130 | +# |
| 131 | +# ``` |
| 132 | +# docker run --rm -p 3000:3000 grafana/plugin-builds:${{ github.event.pull_request.head.sha }}pre |
| 133 | +# ``` |
0 commit comments