This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
456fbf1
commit c663818
Showing
7 changed files
with
134 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,12 @@ name: Release | |
|
||
on: | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
|
||
|
||
permissions: | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
|
||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
SVU_VERSION: 1.11.0 | ||
|
@@ -28,7 +26,7 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: get-tags | ||
- name: get-tags | ||
run: git fetch --force --tags | ||
|
||
- name: Get svu | ||
|
@@ -74,18 +72,17 @@ jobs: | |
GORELEASER_PREVIOUS_TAG: ${{ needs.tag.outputs.PREV_VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- run: git fetch --force --tags | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
go-version: "1.22" | ||
check-latest: true | ||
|
||
|
||
- uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
distribution: goreleaser | ||
|
@@ -94,56 +91,54 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
Docker: | ||
needs: [tag,goreleaser] | ||
needs: [tag, goreleaser] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
check-latest: true | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/[email protected] | ||
id: build-and-push | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.VERSION }} | ||
build-args: | | ||
VERSION=${{ needs.tag.outputs.VERSION }} | ||
- uses: sigstore/[email protected] | ||
|
||
- name: Image Signing | ||
run: | | ||
cosign sign --yes \ | ||
-a "repo=${{ github.repository }}" \ | ||
-a "workflow=${{ github.workflow }}" \ | ||
-a "ref=${{ github.sha }}" \ | ||
-a "owner=Spectro Cloud" \ | ||
--key env://COSIGN_PRIVATE_KEY --recursive "${TAGS}@${DIGEST}" | ||
env: | ||
TAGS: ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.VERSION }} | ||
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} | ||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22" | ||
check-latest: true | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/[email protected] | ||
id: build-and-push | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.VERSION }} | ||
build-args: | | ||
VERSION=${{ needs.tag.outputs.VERSION }} | ||
- uses: sigstore/[email protected] | ||
|
||
- name: Image Signing | ||
run: | | ||
cosign sign --yes \ | ||
-a "repo=${{ github.repository }}" \ | ||
-a "workflow=${{ github.workflow }}" \ | ||
-a "ref=${{ github.sha }}" \ | ||
-a "owner=Spectro Cloud" \ | ||
--key env://COSIGN_PRIVATE_KEY --recursive "${TAGS}@${DIGEST}" | ||
env: | ||
TAGS: ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.VERSION }} | ||
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} | ||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,81 +4,79 @@ To get started, use the following steps. | |
|
||
## Software Requirements | ||
|
||
|
||
If you want to work on Spectromate, you will need to install the following software and actions completed. | ||
|
||
:warning: This project uses Go Modules making it safe to work with it outside of your existing GOPATH | ||
|
||
- [Docker](https://docs.docker.com/get-docker/) v20.10.0 or greater. | ||
|
||
* [Docker](https://docs.docker.com/get-docker/) v20.10.0 or greater. | ||
|
||
* [Go](https://golang.org/doc/install) 1.20 or greater. | ||
- [Go](https://golang.org/doc/install) 1.21 or greater. | ||
|
||
* [Ngrok](https://ngrok.com/download) v3.2.2 or greater. | ||
- [Ngrok](https://ngrok.com/download) v3.2.2 or greater. | ||
|
||
* [A Slack App](https://api.slack.com/apps) available that has access to your target workspace. | ||
- [A Slack App](https://api.slack.com/apps) available that has access to your target workspace. | ||
|
||
## Setup | ||
|
||
The following instructions assume a directory in your home directory outside of the standard GOPATH. | ||
|
||
1. Clone the repository by using the following command. | ||
|
||
```shell | ||
$ mkdir -p $HOME/projects/spectromate/; cd $HOME/projects/spectromate/ | ||
$ git clone [email protected]:spectrocloud/spectromate.git | ||
``` | ||
```shell | ||
$ mkdir -p $HOME/projects/spectromate/; cd $HOME/projects/spectromate/ | ||
$ git clone [email protected]:spectrocloud/spectromate.git | ||
``` | ||
|
||
2. Issue the command `make init`. This command will download all the required project dependencies. | ||
|
||
```shell | ||
make init | ||
``` | ||
```shell | ||
make init | ||
``` | ||
|
||
3. The following command is used to set up the local development support dependencies, such as Redis and Ngork. | ||
|
||
```shell | ||
make start | ||
``` | ||
```shell | ||
make start | ||
``` | ||
|
||
4. Copy the URL Ngrok exposed in the output. | ||
4. Copy the URL Ngrok exposed in the output. | ||
|
||
```shell | ||
$ make start | ||
Starting the application and ngrok... | ||
[+] Running 3/3 | ||
✔ Network docs-slack-bot_default Created 0.0s | ||
✔ Container docs-slack-bot-redis-1 Started 0.3s | ||
✔ Container docs-slack-bot-redis-cli-1 Started 0.5s | ||
Ngrok URL: https://76ac-184-179-188-29.ngrok-free.app | ||
``` | ||
```shell | ||
$ make start | ||
Starting the application and ngrok... | ||
[+] Running 3/3 | ||
✔ Network docs-slack-bot_default Created 0.0s | ||
✔ Container docs-slack-bot-redis-1 Started 0.3s | ||
✔ Container docs-slack-bot-redis-cli-1 Started 0.5s | ||
Ngrok URL: https://76ac-184-179-188-29.ngrok-free.app | ||
``` | ||
|
||
5. Create a `env` file at the root of the project. | ||
|
||
```shell | ||
touch .env | ||
``` | ||
```shell | ||
touch .env | ||
``` | ||
|
||
6. Populate the **.env** file with your respective credentials. | ||
|
||
```shell | ||
export SLACK_SIGNING_SECRET=.... | ||
export MENDABLE_API_KEY=.... | ||
``` | ||
```shell | ||
export SLACK_SIGNING_SECRET=.... | ||
export MENDABLE_API_KEY=.... | ||
``` | ||
|
||
7. Start the local server. | ||
|
||
```shell | ||
make server | ||
``` | ||
```shell | ||
make server | ||
``` | ||
|
||
8. Source the `.env` file. | ||
|
||
```shell | ||
source .env | ||
``` | ||
|
||
9. Navigate to your [Slack app ](https://api.slack.com/apps) and open up your app's details page. | ||
```shell | ||
source .env | ||
``` | ||
|
||
9. Navigate to your [Slack app ](https://api.slack.com/apps) and open up your app's details page. | ||
|
||
10. You will access both elements highlighted in the image. Start with the first element, by clicking on the left **Main Menu** and selecting **Slash Command**. | ||
|
||
|
@@ -90,28 +88,25 @@ The following instructions assume a directory in your home directory outside of | |
|
||
12. Save your changes and navigate back to the main details page. | ||
|
||
13. From the left **Main Menu**, select **Interactivity & Shortcuts**. | ||
|
||
14. Toggle the **Interactvity** button to **On**. | ||
14. Toggle the **Interactvity** button to **On**. | ||
|
||
15. Use your Ngrok URL and paste the URL into the text input box. Append `/api/v1/slack/actions` to the end of the URL and save your changes. | ||
|
||
![View of the interactivity options view](../static/images/slack_interactivity_view.png) | ||
|
||
16. Navigate to a Slack channel and issue the Slack command `/docs help`. | ||
|
||
You should receive an output similar to the following. | ||
|
||
![View of the Slack command in use](../static/images/slack_command_issued.png) | ||
|
||
You now have a functional test application connected to your local workstation. | ||
You now have a functional test application connected to your local workstation. | ||
|
||
17. Stop the local server by pressing the `Ctrl` + `C`. | ||
|
||
Make your changes and start the server with the `make server` command to test the new behavior. | ||
Make your changes and start the server with the `make server` command to test the new behavior. | ||
|
||
```shell | ||
make server | ||
|
@@ -125,10 +120,10 @@ go run main.go | |
|
||
``` | ||
|
||
## Testing | ||
|
||
Add test cases to new functions and new commands. Invoke the Go tests from the root namespace. The pipeline will invoke the Go tests as well. | ||
|
||
```shell | ||
go test -race ./... | ||
``` | ||
``` |
Oops, something went wrong.