From 80638c62abe0b6414cbe6ff94c4060a5d05ca97f Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 22 Oct 2024 13:19:21 -0600 Subject: [PATCH 01/14] INFOPLAT-1402 Adds gh for running beholder-ci --- .changeset/loud-jobs-rescue.md | 5 ++ actions/ci-beholder-schema-validate/README.md | 3 ++ .../ci-beholder-schema-validate/action.yml | 53 +++++++++++++++++++ actions/ci-beholder-schema-validate/debug.sh | 8 +++ .../ci-beholder-schema-validate/package.json | 11 ++++ .../ci-beholder-schema-validate/project.json | 7 +++ pnpm-lock.yaml | 4 ++ 7 files changed, 91 insertions(+) create mode 100644 .changeset/loud-jobs-rescue.md create mode 100644 actions/ci-beholder-schema-validate/README.md create mode 100644 actions/ci-beholder-schema-validate/action.yml create mode 100644 actions/ci-beholder-schema-validate/debug.sh create mode 100644 actions/ci-beholder-schema-validate/package.json create mode 100644 actions/ci-beholder-schema-validate/project.json diff --git a/.changeset/loud-jobs-rescue.md b/.changeset/loud-jobs-rescue.md new file mode 100644 index 00000000..16ed4bb2 --- /dev/null +++ b/.changeset/loud-jobs-rescue.md @@ -0,0 +1,5 @@ +--- +"ci-beholder-schema-validate": major +--- + +Initial implementation of beholder ci action diff --git a/actions/ci-beholder-schema-validate/README.md b/actions/ci-beholder-schema-validate/README.md new file mode 100644 index 00000000..b8d5d85a --- /dev/null +++ b/actions/ci-beholder-schema-validate/README.md @@ -0,0 +1,3 @@ +# ci-beholder-schema-validate + +> Action to validate beholder schemas diff --git a/actions/ci-beholder-schema-validate/action.yml b/actions/ci-beholder-schema-validate/action.yml new file mode 100644 index 00000000..7b7440df --- /dev/null +++ b/actions/ci-beholder-schema-validate/action.yml @@ -0,0 +1,53 @@ +name: ci-beholder-schema-validate +description: "Action to validate beholder schemas" + +inputs: + beholder-config-file: + description: + "Path to the beholder config yaml file relative to the repository root" + required: true + aws-role-arn: + description: ARN of role capable of getting token from GATI + required: true + aws-lambda-url: + description: URL of GATI lambda function + required: true + aws-region: + description: AWS region + required: true + default: "us-west-2" + +runs: + using: "composite" + steps: + - name: Setup GitHub Token + id: setup-github-token + uses: smartcontractkit/.github/actions/setup-github-token@7ac9af09dda8c553593d2153a975b43b6958fa9f # setup-github-token@0.1.2 + with: + aws-role-arn: ${{ inputs.aws-role-arn }} + aws-lambda-url: ${{ inputs.aws-lambda-url }} + aws-region: ${{ inputs.aws-region }} + + - name: Checkout rtsp-tookit Repository + uses: actions/checkout@v3 + with: + repository: smartcontractkit/rtsp-toolkit + ref: main + token: ${{ steps.setup-github-token.outputs.access-token }} + path: rtsp-toolkit + + - name: Setup go + uses: smartcontractkit/.github/actions/setup-golang@7ac9af09dda8c553593d2153a975b43b6958fa9f + + - name: Build Beholder CI Binary + shell: bash + working-directory: rtsp-toolkit + run: | + cd ./beholder + go build -o ../beholder-ci + + - name: Run Beholder CI + shell: bash + working-directory: rtsp-toolkit + run: | + ./beholder-ci schema-validate -f ${{ inputs.beholder-config-file }} diff --git a/actions/ci-beholder-schema-validate/debug.sh b/actions/ci-beholder-schema-validate/debug.sh new file mode 100644 index 00000000..f10e49e0 --- /dev/null +++ b/actions/ci-beholder-schema-validate/debug.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +## +# Debug script +## + +echo "TODO" diff --git a/actions/ci-beholder-schema-validate/package.json b/actions/ci-beholder-schema-validate/package.json new file mode 100644 index 00000000..1f44f0b0 --- /dev/null +++ b/actions/ci-beholder-schema-validate/package.json @@ -0,0 +1,11 @@ +{ + "name": "ci-beholder-schema-validate", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": {}, + "author": "@smartcontractkit", + "license": "MIT", + "dependencies": {}, + "repository": "https://github.com/smartcontractkit/.github" +} diff --git a/actions/ci-beholder-schema-validate/project.json b/actions/ci-beholder-schema-validate/project.json new file mode 100644 index 00000000..1d375e9a --- /dev/null +++ b/actions/ci-beholder-schema-validate/project.json @@ -0,0 +1,7 @@ +{ + "name": "ci-beholder-schema-validate", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "sourceRoot": "actions/ci-beholder-schema-validate", + "targets": {} +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4c1a3aa7..3ff9a1b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -211,6 +211,8 @@ importers: actions/manifest-build: {} + actions/md-confluence-sync: {} + actions/nops-upgrade-checker: {} actions/policy-bot-config-validator: {} @@ -225,6 +227,8 @@ importers: actions/setup-nix: {} + actions/setup-nix-cache: {} + actions/setup-nix-gati: {} actions/setup-nodejs: {} From 1bda585396f1a9cd749eba2d30b2388f2510f4d2 Mon Sep 17 00:00:00 2001 From: hendoxc Date: Mon, 28 Oct 2024 15:16:08 -0600 Subject: [PATCH 02/14] INFOPLAT-768 Dockerfile action - adds go app to run in container --- .../ci-beholder-schema-validate/Dockerfile | 24 +++++++ actions/ci-beholder-schema-validate/README.md | 25 ++++++++ .../ci-beholder-schema-validate/action.yml | 62 ++++--------------- .../src/cmd/root.go | 31 ++++++++++ .../src/cmd/validate.go | 32 ++++++++++ .../ci-beholder-schema-validate/src/go.mod | 10 +++ .../ci-beholder-schema-validate/src/go.sum | 10 +++ .../ci-beholder-schema-validate/src/main.go | 10 +++ 8 files changed, 154 insertions(+), 50 deletions(-) create mode 100644 actions/ci-beholder-schema-validate/Dockerfile create mode 100644 actions/ci-beholder-schema-validate/src/cmd/root.go create mode 100644 actions/ci-beholder-schema-validate/src/cmd/validate.go create mode 100644 actions/ci-beholder-schema-validate/src/go.mod create mode 100644 actions/ci-beholder-schema-validate/src/go.sum create mode 100644 actions/ci-beholder-schema-validate/src/main.go diff --git a/actions/ci-beholder-schema-validate/Dockerfile b/actions/ci-beholder-schema-validate/Dockerfile new file mode 100644 index 00000000..e9e1e5ff --- /dev/null +++ b/actions/ci-beholder-schema-validate/Dockerfile @@ -0,0 +1,24 @@ +# BUILD step +FROM golang:1.23-alpine AS builder + +RUN apk add --no-progress --no-cache \ + gcc \ + musl-dev \ + linux-headers + +# Switch to app dir +WORKDIR /app + +COPY ./src ./ + +RUN go build -a -tags musl -o beholder-ci + +# PACKAGE step +FROM alpine:latest +RUN apk add --no-cache ca-certificates +RUN adduser -u 1000 -D beholder-ci + +WORKDIR /app + +COPY --from=builder /app/beholder-ci /app/beholder-ci +ENTRYPOINT ["/app/beholder-ci"] \ No newline at end of file diff --git a/actions/ci-beholder-schema-validate/README.md b/actions/ci-beholder-schema-validate/README.md index b8d5d85a..fcbe73df 100644 --- a/actions/ci-beholder-schema-validate/README.md +++ b/actions/ci-beholder-schema-validate/README.md @@ -1,3 +1,28 @@ # ci-beholder-schema-validate > Action to validate beholder schemas + +## Running app in docker + +you can demo the application by building the docker image + +```shell +docker build -t ci-beholder:latest . --no-cache +``` + +then running the app in the container + +```shell +docker run --rm -v ./src/beholder_config.txt:/opt/beholder_config.txt beholder-ci:latest validate -f /opt/beholder_config.txt +``` + +#### whats happening in the command above + +- `run --rm` runs the container, and when the process running in the container + exits, delete the container +- `-v ./src/beholder_config.txt:/opt/beholder_config.txt` we are mounting a + local file to the container, at the location `/opt/`. In Github actions the + whole repo is mounted automatically to the container +- `beholder-ci:latest` image that we want to run +- `validate -f /opt/beholder_config.txt` is the command to the app we want to + run along with relevant flags` diff --git a/actions/ci-beholder-schema-validate/action.yml b/actions/ci-beholder-schema-validate/action.yml index 7b7440df..7df2bb59 100644 --- a/actions/ci-beholder-schema-validate/action.yml +++ b/actions/ci-beholder-schema-validate/action.yml @@ -1,53 +1,15 @@ -name: ci-beholder-schema-validate -description: "Action to validate beholder schemas" - +# action.yml +name: "Beholder Schema Validation" +description: "Validate schemas for Beholder usage" inputs: - beholder-config-file: - description: - "Path to the beholder config yaml file relative to the repository root" + beholder-config-file-path: # id of input + description: "path to beholder configuration yaml file" required: true - aws-role-arn: - description: ARN of role capable of getting token from GATI - required: true - aws-lambda-url: - description: URL of GATI lambda function - required: true - aws-region: - description: AWS region - required: true - default: "us-west-2" - +outputs: {} runs: - using: "composite" - steps: - - name: Setup GitHub Token - id: setup-github-token - uses: smartcontractkit/.github/actions/setup-github-token@7ac9af09dda8c553593d2153a975b43b6958fa9f # setup-github-token@0.1.2 - with: - aws-role-arn: ${{ inputs.aws-role-arn }} - aws-lambda-url: ${{ inputs.aws-lambda-url }} - aws-region: ${{ inputs.aws-region }} - - - name: Checkout rtsp-tookit Repository - uses: actions/checkout@v3 - with: - repository: smartcontractkit/rtsp-toolkit - ref: main - token: ${{ steps.setup-github-token.outputs.access-token }} - path: rtsp-toolkit - - - name: Setup go - uses: smartcontractkit/.github/actions/setup-golang@7ac9af09dda8c553593d2153a975b43b6958fa9f - - - name: Build Beholder CI Binary - shell: bash - working-directory: rtsp-toolkit - run: | - cd ./beholder - go build -o ../beholder-ci - - - name: Run Beholder CI - shell: bash - working-directory: rtsp-toolkit - run: | - ./beholder-ci schema-validate -f ${{ inputs.beholder-config-file }} + using: "docker" + image: "Dockerfile" + args: + - validate + - "-f" + - ${{ inputs.who-to-greet }} diff --git a/actions/ci-beholder-schema-validate/src/cmd/root.go b/actions/ci-beholder-schema-validate/src/cmd/root.go new file mode 100644 index 00000000..f8fec4e6 --- /dev/null +++ b/actions/ci-beholder-schema-validate/src/cmd/root.go @@ -0,0 +1,31 @@ +package cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + + +var rootCmd = &cobra.Command{ + Use: "ci-beholder-schema-validate", + Short: "Schema validation", + Long: `Schema validation`, +} + +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +var beholderFilePath string + +func init() { + + // add persistent flag for beholder file path + rootCmd.PersistentFlags().StringVarP(&beholderFilePath, "beholder-file", "f", "", "beholder file path") + _ = rootCmd.MarkPersistentFlagRequired("beholder-file") + +} diff --git a/actions/ci-beholder-schema-validate/src/cmd/validate.go b/actions/ci-beholder-schema-validate/src/cmd/validate.go new file mode 100644 index 00000000..2ee398f6 --- /dev/null +++ b/actions/ci-beholder-schema-validate/src/cmd/validate.go @@ -0,0 +1,32 @@ +package cmd + +import ( + "fmt" + "log" + "os" + + "github.com/spf13/cobra" +) + +var validateCmd = &cobra.Command{ + Use: "validate", + Short: "Validate schemas", + Long: `Validate schemas`, + Run: runValidateCmd, +} + +func init() { + rootCmd.AddCommand(validateCmd) +} + +func runValidateCmd(cmd *cobra.Command, args []string) { + + beholderFileContents, err := os.ReadFile(beholderFilePath) + if err != nil { + log.Panic(err) + } + + fmt.Printf("beholderFileContents: %s", beholderFileContents) + +} + diff --git a/actions/ci-beholder-schema-validate/src/go.mod b/actions/ci-beholder-schema-validate/src/go.mod new file mode 100644 index 00000000..599c64a4 --- /dev/null +++ b/actions/ci-beholder-schema-validate/src/go.mod @@ -0,0 +1,10 @@ +module schema-validate + +go 1.23.2 + +require github.com/spf13/cobra v1.8.1 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect +) diff --git a/actions/ci-beholder-schema-validate/src/go.sum b/actions/ci-beholder-schema-validate/src/go.sum new file mode 100644 index 00000000..912390a7 --- /dev/null +++ b/actions/ci-beholder-schema-validate/src/go.sum @@ -0,0 +1,10 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/actions/ci-beholder-schema-validate/src/main.go b/actions/ci-beholder-schema-validate/src/main.go new file mode 100644 index 00000000..49173baa --- /dev/null +++ b/actions/ci-beholder-schema-validate/src/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "schema-validate/cmd" +) + + +func main() { + cmd.Execute() +} \ No newline at end of file From f148706554b99599cbe0002ecc4a810ab53f7856 Mon Sep 17 00:00:00 2001 From: hendoxc Date: Mon, 28 Oct 2024 15:24:11 -0600 Subject: [PATCH 03/14] INFOPLAT-768 Fixes action args --- actions/ci-beholder-schema-validate/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/ci-beholder-schema-validate/action.yml b/actions/ci-beholder-schema-validate/action.yml index 7df2bb59..e6743b55 100644 --- a/actions/ci-beholder-schema-validate/action.yml +++ b/actions/ci-beholder-schema-validate/action.yml @@ -12,4 +12,4 @@ runs: args: - validate - "-f" - - ${{ inputs.who-to-greet }} + - ${{ inputs.beholder-config-file-path }} From 8bdb833a29ab23000726c6f07fbb8c14f2066e4f Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 11:25:01 -0600 Subject: [PATCH 04/14] Renames file to use `.yaml` extension --- actions/ci-beholder-schema-validate/{action.yml => action.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename actions/ci-beholder-schema-validate/{action.yml => action.yaml} (100%) diff --git a/actions/ci-beholder-schema-validate/action.yml b/actions/ci-beholder-schema-validate/action.yaml similarity index 100% rename from actions/ci-beholder-schema-validate/action.yml rename to actions/ci-beholder-schema-validate/action.yaml From 74858f815ae0a5d9e882f29c127e638b4ca1636a Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 15:32:19 -0600 Subject: [PATCH 05/14] Adds some file dir logging for my sanity also i don't know where gh is mounting the directory --- .../src/cmd/validate.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/actions/ci-beholder-schema-validate/src/cmd/validate.go b/actions/ci-beholder-schema-validate/src/cmd/validate.go index 2ee398f6..8d2ade10 100644 --- a/actions/ci-beholder-schema-validate/src/cmd/validate.go +++ b/actions/ci-beholder-schema-validate/src/cmd/validate.go @@ -21,6 +21,25 @@ func init() { func runValidateCmd(cmd *cobra.Command, args []string) { + // show cuurent working directory + cwd, err := os.Getwd() + if err != nil { + log.Panic(err) + } + + fmt.Printf("Current working directory: %s\n", cwd) + + // show all files in current working directory + files, err := os.ReadDir(cwd) + if err != nil { + log.Panic(err) + } + + for _, file := range files { + fmt.Printf("File: %s\n", file.Name()) + } + + beholderFileContents, err := os.ReadFile(beholderFilePath) if err != nil { log.Panic(err) From 873b819e1c778f4aa93ca340aa6d16c6183541fa Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 15:37:47 -0600 Subject: [PATCH 06/14] Update dockerfile to use root it says to do so in the docs --- actions/ci-beholder-schema-validate/Dockerfile | 1 - actions/ci-beholder-schema-validate/src/cmd/validate.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/actions/ci-beholder-schema-validate/Dockerfile b/actions/ci-beholder-schema-validate/Dockerfile index e9e1e5ff..f5377529 100644 --- a/actions/ci-beholder-schema-validate/Dockerfile +++ b/actions/ci-beholder-schema-validate/Dockerfile @@ -16,7 +16,6 @@ RUN go build -a -tags musl -o beholder-ci # PACKAGE step FROM alpine:latest RUN apk add --no-cache ca-certificates -RUN adduser -u 1000 -D beholder-ci WORKDIR /app diff --git a/actions/ci-beholder-schema-validate/src/cmd/validate.go b/actions/ci-beholder-schema-validate/src/cmd/validate.go index 8d2ade10..08f480ea 100644 --- a/actions/ci-beholder-schema-validate/src/cmd/validate.go +++ b/actions/ci-beholder-schema-validate/src/cmd/validate.go @@ -29,7 +29,7 @@ func runValidateCmd(cmd *cobra.Command, args []string) { fmt.Printf("Current working directory: %s\n", cwd) - // show all files in current working directory + // show all files and directories in the current working directory files, err := os.ReadDir(cwd) if err != nil { log.Panic(err) From 11d0e60f221abd08972e9847329fb13705b97893 Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 15:48:04 -0600 Subject: [PATCH 07/14] Adds more diagnostics --- actions/ci-beholder-schema-validate/src/cmd/validate.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/actions/ci-beholder-schema-validate/src/cmd/validate.go b/actions/ci-beholder-schema-validate/src/cmd/validate.go index 08f480ea..5f9ebb69 100644 --- a/actions/ci-beholder-schema-validate/src/cmd/validate.go +++ b/actions/ci-beholder-schema-validate/src/cmd/validate.go @@ -35,6 +35,10 @@ func runValidateCmd(cmd *cobra.Command, args []string) { log.Panic(err) } + + fmt.Printf("Files and directories %s\n", files) + + for _, file := range files { fmt.Printf("File: %s\n", file.Name()) } From d17cec6eef3ed06316c8946bf3c6de92c1b18c6d Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 16:10:10 -0600 Subject: [PATCH 08/14] Runs ls --- actions/ci-beholder-schema-validate/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/ci-beholder-schema-validate/Dockerfile b/actions/ci-beholder-schema-validate/Dockerfile index f5377529..677c0e64 100644 --- a/actions/ci-beholder-schema-validate/Dockerfile +++ b/actions/ci-beholder-schema-validate/Dockerfile @@ -20,4 +20,4 @@ RUN apk add --no-cache ca-certificates WORKDIR /app COPY --from=builder /app/beholder-ci /app/beholder-ci -ENTRYPOINT ["/app/beholder-ci"] \ No newline at end of file +ENTRYPOINT ["ls"] \ No newline at end of file From 49056c1f90814e1abcd8fde9cc132193a6a3d2a7 Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 16:13:10 -0600 Subject: [PATCH 09/14] Passes no commands to action --- actions/ci-beholder-schema-validate/action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actions/ci-beholder-schema-validate/action.yaml b/actions/ci-beholder-schema-validate/action.yaml index e6743b55..5d6ae958 100644 --- a/actions/ci-beholder-schema-validate/action.yaml +++ b/actions/ci-beholder-schema-validate/action.yaml @@ -9,7 +9,7 @@ outputs: {} runs: using: "docker" image: "Dockerfile" - args: - - validate - - "-f" - - ${{ inputs.beholder-config-file-path }} + # args: + # - validate + # - "-f" + # - ${{ inputs.beholder-config-file-path }} From 1f4212b27fe1212600ce189be48f41b3d585319d Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 16:16:14 -0600 Subject: [PATCH 10/14] Adjusts dockerfile --- actions/ci-beholder-schema-validate/Dockerfile | 5 +---- actions/ci-beholder-schema-validate/action.yaml | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/actions/ci-beholder-schema-validate/Dockerfile b/actions/ci-beholder-schema-validate/Dockerfile index 677c0e64..a1ef06fc 100644 --- a/actions/ci-beholder-schema-validate/Dockerfile +++ b/actions/ci-beholder-schema-validate/Dockerfile @@ -15,9 +15,6 @@ RUN go build -a -tags musl -o beholder-ci # PACKAGE step FROM alpine:latest -RUN apk add --no-cache ca-certificates - -WORKDIR /app COPY --from=builder /app/beholder-ci /app/beholder-ci -ENTRYPOINT ["ls"] \ No newline at end of file +ENTRYPOINT ["/app/beholder-ci"] \ No newline at end of file diff --git a/actions/ci-beholder-schema-validate/action.yaml b/actions/ci-beholder-schema-validate/action.yaml index 5d6ae958..1de213ce 100644 --- a/actions/ci-beholder-schema-validate/action.yaml +++ b/actions/ci-beholder-schema-validate/action.yaml @@ -9,7 +9,5 @@ outputs: {} runs: using: "docker" image: "Dockerfile" - # args: - # - validate - # - "-f" - # - ${{ inputs.beholder-config-file-path }} + args: + - validate -f ${{ inputs.beholder-config-file-path }} From 0c8025a58c545712fd473db51a29036d48cce4ce Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 16:22:57 -0600 Subject: [PATCH 11/14] Fixes action --- actions/ci-beholder-schema-validate/action.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/actions/ci-beholder-schema-validate/action.yaml b/actions/ci-beholder-schema-validate/action.yaml index 1de213ce..2ab039f4 100644 --- a/actions/ci-beholder-schema-validate/action.yaml +++ b/actions/ci-beholder-schema-validate/action.yaml @@ -10,4 +10,6 @@ runs: using: "docker" image: "Dockerfile" args: - - validate -f ${{ inputs.beholder-config-file-path }} + - validate + - -f + - ${{ inputs.beholder-config-file-path }} From 6576a43057107756be56f3e0dce4f175cd326204 Mon Sep 17 00:00:00 2001 From: hendoxc Date: Tue, 29 Oct 2024 16:47:54 -0600 Subject: [PATCH 12/14] Removes diagnostics --- .../src/cmd/validate.go | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/actions/ci-beholder-schema-validate/src/cmd/validate.go b/actions/ci-beholder-schema-validate/src/cmd/validate.go index 5f9ebb69..2ee398f6 100644 --- a/actions/ci-beholder-schema-validate/src/cmd/validate.go +++ b/actions/ci-beholder-schema-validate/src/cmd/validate.go @@ -21,29 +21,6 @@ func init() { func runValidateCmd(cmd *cobra.Command, args []string) { - // show cuurent working directory - cwd, err := os.Getwd() - if err != nil { - log.Panic(err) - } - - fmt.Printf("Current working directory: %s\n", cwd) - - // show all files and directories in the current working directory - files, err := os.ReadDir(cwd) - if err != nil { - log.Panic(err) - } - - - fmt.Printf("Files and directories %s\n", files) - - - for _, file := range files { - fmt.Printf("File: %s\n", file.Name()) - } - - beholderFileContents, err := os.ReadFile(beholderFilePath) if err != nil { log.Panic(err) From f4153d764882b23307cbabfa73ff972c8cabb9d4 Mon Sep 17 00:00:00 2001 From: hendoxc Date: Wed, 30 Oct 2024 08:49:28 -0600 Subject: [PATCH 13/14] INFOPLAT-768 Addressed review comments - changeset with minor version - removes `debug.sh` file - change author to myself --- .changeset/quick-hornets-dress.md | 5 +++++ actions/ci-beholder-schema-validate/debug.sh | 8 -------- actions/ci-beholder-schema-validate/package.json | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 .changeset/quick-hornets-dress.md delete mode 100644 actions/ci-beholder-schema-validate/debug.sh diff --git a/.changeset/quick-hornets-dress.md b/.changeset/quick-hornets-dress.md new file mode 100644 index 00000000..616a120d --- /dev/null +++ b/.changeset/quick-hornets-dress.md @@ -0,0 +1,5 @@ +--- +"ci-beholder-schema-validate": minor +--- + +First initial minor release diff --git a/actions/ci-beholder-schema-validate/debug.sh b/actions/ci-beholder-schema-validate/debug.sh deleted file mode 100644 index f10e49e0..00000000 --- a/actions/ci-beholder-schema-validate/debug.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -## -# Debug script -## - -echo "TODO" diff --git a/actions/ci-beholder-schema-validate/package.json b/actions/ci-beholder-schema-validate/package.json index 1f44f0b0..8d252a31 100644 --- a/actions/ci-beholder-schema-validate/package.json +++ b/actions/ci-beholder-schema-validate/package.json @@ -4,7 +4,7 @@ "description": "", "private": true, "scripts": {}, - "author": "@smartcontractkit", + "author": "@hendoxc", "license": "MIT", "dependencies": {}, "repository": "https://github.com/smartcontractkit/.github" From d3eaeba5e2e1e05c16870292bbdb03f9d9cb283f Mon Sep 17 00:00:00 2001 From: hendoxc Date: Wed, 30 Oct 2024 08:50:09 -0600 Subject: [PATCH 14/14] INFOPLAT-768 Removes old changeset file --- .changeset/loud-jobs-rescue.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/loud-jobs-rescue.md diff --git a/.changeset/loud-jobs-rescue.md b/.changeset/loud-jobs-rescue.md deleted file mode 100644 index 16ed4bb2..00000000 --- a/.changeset/loud-jobs-rescue.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"ci-beholder-schema-validate": major ---- - -Initial implementation of beholder ci action