You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/06/14 06:13:14 UTC

[skywalking-cli] branch gha/event created (now a992d22)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a change to branch gha/event
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git.


      at a992d22  Test GHA

This branch includes the following new commits:

     new a992d22  Test GHA

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[skywalking-cli] 01/01: Test GHA

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch gha/event
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git

commit a992d224ce29a790219da924cfbdbc19b783df30
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Mon Jun 14 14:13:00 2021 +0800

    Test GHA
---
 Dockerfile                | 35 ++++++++++++++++++++++
 Makefile                  |  8 ++++-
 actions/event/action.yaml | 76 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..78b11be
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+FROM golang:1.14 AS builder
+
+ENV CGO_ENABLED=0
+ENV GO111MODULE=on
+
+WORKDIR /cli
+
+COPY go.* .
+
+RUN go mod download
+
+COPY . .
+
+RUN make linux && mv bin/swctl-*-linux-amd64 /swctl
+
+FROM alpine
+
+COPY --from=builder /swctl /swctl
+
+ENTRYPOINT [ "/swctl" ]
diff --git a/Makefile b/Makefile
index 448f123..ce8793a 100644
--- a/Makefile
+++ b/Makefile
@@ -15,10 +15,12 @@
 # limitations under the License.
 #
 
-VERSION ?= latest
+VERSION ?= dev-$(shell git rev-parse --short HEAD)
 OUT_DIR = bin
 BINARY = swctl
 
+HUB ?= apache/skywalking-cli
+
 RELEASE_BIN = skywalking-cli-$(VERSION)-bin
 RELEASE_SRC = skywalking-cli-$(VERSION)-src
 
@@ -144,6 +146,10 @@ check-codegen:
 		exit 1; \
 	fi
 
+.PHONY: docker
+docker:
+	docker build . -t $(HUB):$(VERSION)
+
 .PHONY: test-commands
 test-commands:
 	@if ! docker run --name oap -p 12800:12800 -p 11800:11800 -d -e SW_HEALTH_CHECKER=default -e SW_TELEMETRY=prometheus apache/skywalking-oap-server:8.4.0-es7 > /dev/null 2>&1;then \
diff --git a/actions/event/action.yaml b/actions/event/action.yaml
new file mode 100644
index 0000000..48782d2
--- /dev/null
+++ b/actions/event/action.yaml
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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: SkyWalking Event Reporter
+description: Report GitHub workflow events to Apache SkyWalking
+author: Apache SkyWalking
+inputs:
+  oap-url:
+    description: URL of SkyWalking OAP
+    required: true
+  auth-token:
+    description: Authorization token of SkyWalking OAP
+    required: false
+  name:
+    description: The name of the event, for example, "Upgrade"
+    required: false
+    default: Upgrade
+  service:
+    description: The service name of the event
+    required: true
+  instance:
+    description: The service instance of the event
+    required: true
+  endpoint:
+    description: The service endpoint of the event, if any
+    required: false
+  message:
+    description: The message of the event
+    required: false
+    default: Upgrade from {fromVersion} to {toVersion}
+  parameters:
+    description: The parameters in the message
+    required: false
+
+runs:
+  using: docker
+  image: Dockerfile
+  entrypoint: >-
+    - /swctl
+    - --grpcAddr=${{ inputs.oap-url }}
+    - event report
+    - --uuid=$(uuidgen)
+    - --name=${{ inputs.name }}
+    - --service=${{ inputs.service }}
+    - --instance=${{ inputs.instance }}
+    - --endpoint=${{ inputs.endpoint }}
+    - --message=${{ inputs.message }}
+    - --startTime=`date +%s`000
+    - --endTime=`date +%s`000
+    - ${{ inputs.parameters }}
+  post-entrypoint: >-
+    - /swctl
+    - --grpcAddr=${{ inputs.oap-url }}
+    - event report
+    - --uuid=$(uuidgen)
+    - --name=${{ inputs.name }}
+    - --service=${{ inputs.service }}
+    - --instance=${{ inputs.instance }}
+    - --endpoint=${{ inputs.endpoint }}
+    - --message=${{ inputs.message }}
+    - --startTime=`date +%s`000
+    - --endTime=`date +%s`000
+    - ${{ inputs.parameters }}