From 82d574a8db2d7a355ac887360d006a645790f3bf Mon Sep 17 00:00:00 2001 From: "Superskyyy (Back)" Date: Tue, 7 Nov 2023 01:20:15 -0500 Subject: [PATCH] Auto build and push r3 image to ghcr (#7) --- .github/workflows/CI.yaml | 2 +- .github/workflows/publish-docker.yaml | 57 +++++++++++++++++++++++++++ models/uri_drain/uri_drain.py | 2 +- tools/grpc_gen.py | 2 +- 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish-docker.yaml diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index f5687e0..fcc45db 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -19,7 +19,7 @@ on: pull_request: push: branches: - - master + - main schedule: - cron: '0 18 * * *' diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml new file mode 100644 index 0000000..6cb4452 --- /dev/null +++ b/.github/workflows/publish-docker.yaml @@ -0,0 +1,57 @@ +# Copyright 2023 SkyAPM org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: publish-docker + +on: + push: + branches: + - main + release: + types: + - released + +jobs: + build-docker: + # if: github.repository == 'SkyAPM/R3' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + timeout-minutes: 120 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/models/uri_drain/uri_drain.py b/models/uri_drain/uri_drain.py index c3b75d2..37c377f 100644 --- a/models/uri_drain/uri_drain.py +++ b/models/uri_drain/uri_drain.py @@ -484,7 +484,7 @@ def create_template(self, seq1, seq2): # /api/getconnection # /api/dropconnection if seq_length == 2: - if (seq1[0] == seq2[0] and seq1[1] != seq2[1] # can be simplified + if (seq1[0] == seq2[0] and seq1[1] != seq2[1] # can be simplified and not self.has_numbers(seq1[1]) and not self.has_numbers(seq2[1])): print(f'first token match but second token mismatch, seq1 = {seq1}, seq2 = {seq2}') return 'rejected' diff --git a/tools/grpc_gen.py b/tools/grpc_gen.py index 3bf219a..73b4388 100644 --- a/tools/grpc_gen.py +++ b/tools/grpc_gen.py @@ -1,4 +1,4 @@ -# Copyright 2022 SkyAPM org +# Copyright 2023 SkyAPM org # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.