Skip to content

Commit

Permalink
feat: update to latest runrs API and fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cdbrkfxrpt committed Nov 7, 2024
1 parent 914ce2f commit 5cbba4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
uses: golangci/golangci-lint-action@v6
with:
version: latest

Expand All @@ -45,20 +45,14 @@ jobs:
ports:
- 3000:3000
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
# Temporarily download Terraform 1.8 prerelease for function documentation support.
# When Terraform 1.8.0 final is released, this can be removed.
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.8.0-alpha20240216'
terraform_wrapper: false
- name: pull latest OpenAPI schema for runrs and generate code
run: |
curl -O http://0.0.0.0:3000/api-docs/runrs-api.json && go generate ./...
curl -O http://localhost:3000/api-docs/runrs-api.json && go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
Expand Down Expand Up @@ -93,12 +87,12 @@ jobs:
- '1.8.*'
- '1.*.*'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
Expand Down
4 changes: 2 additions & 2 deletions internal/clients/runrs.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runrs-api.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"openapi":"3.0.3","info":{"title":"runrs","description":"A microservice to manage GitLab Runners in Docker via REST","contact":{"name":"bmc"},"license":{"name":"Apache-2.0"},"version":"0.6.0"},"servers":[{"url":"http://0.0.0.0:3000/","description":"Local development server"}],"paths":{"/gitlab-runners":{"post":{"tags":["gitlab_runners"],"operationId":"create","requestBody":{"description":"GitLabRunner to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}},"required":true},"responses":{"201":{"description":"Created new GitLab Runner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"400":{"description":"GitLab Runner already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gitlab-runners/list":{"get":{"tags":["gitlab_runners"],"operationId":"list","responses":{"200":{"description":"Read all GitLabRunners","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gitlab-runners/{uuid}":{"get":{"tags":["gitlab_runners"],"operationId":"read","parameters":[{"name":"uuid","in":"path","description":"GitLabRunner UUID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Read all GitLabRunners","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gitlab_runners"],"operationId":"update","parameters":[{"name":"uuid","in":"path","description":"GitLab Runner UUID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"GitLabRunner to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}},"required":true},"responses":{"200":{"description":"Updated GitLabRunner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"204":{"description":"GitLabRunner already up-to-date"},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gitlab_runners"],"operationId":"delete","parameters":[{"name":"uuid","in":"path","description":"GitLabRunner UUID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted GitLabRunner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["err_type","msg"],"properties":{"err_type":{"$ref":"#/components/schemas/ErrorType"},"msg":{"type":"string"}}},"ErrorType":{"type":"string","enum":["ConnectionFailed","InvalidArgument","AlreadyExists","Forbidden","Unchanged","NotFound","BadRequest","InternalError","Unimplemented","Other"]},"GitLabRunner":{"type":"object","description":"Public API for configuring a single CI/CD job executor, not the GitLab Runner service.\n\nGitLab publish a service binary they refer to as \"GitLab Runner\". You can install it locally or\non you server [as per its documentation](https://docs.gitlab.com/runner/install/). This binary\nis, however, *not* the CI/CD job executor; rather, it _manages_ the executors. As such, when you\n\"register a runner\" (as per [their documentation](https://docs.gitlab.com/runner/register/)),\nyou use the `gitlab-runner` binary to do so.\n\nThe `GitLabRunner` struct replicates the API of the `gitlab-runner` binary, albeit exposing a\nsmaller configuration surface. In other words: if you run `gitlab-runner register --help`, you\nget a list of options. We support a subset of those options, and those which are supported are\nnamed the same here as they are in `gitlab-runner`, except in `snake_case` instead of\n`kebab-case`. For example, `--docker-image` becomes `docker_image`.","required":["id","url","token","docker_image"],"properties":{"docker_image":{"type":"string","description":"Docker image to be used","example":"alpine:latest"},"id":{"type":"integer","format":"int32","description":"ID of the runner within the GitLab instance; unique for that GitLab instance","minimum":0},"name":{"type":"string","description":"Runner name (default: Docker-style random name)","example":"usain-bolt"},"token":{"type":"string","description":"Runner token, obtained from the GitLab instance. Format: `glrt-` followed by 20 characters\nfrom the set `[0-9a-f_]`.","example":"glrt-0123456789_abcdefXYZ"},"token_obtained_at":{"type":"string","format":"date-time","example":"2023-08-23T23:23:23Z"},"url":{"type":"string","format":"uri","description":"GitLab instance URL","example":"https://gitlab.your-company.com"},"uuid":{"type":"string","format":"uuid","example":"be924fdd-fb28-468c-8c70-1f0ed3af4485"}}}},"securitySchemes":{"api_token":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"security":[{"api_token":[]}],"tags":[{"name":"runrs","description":"GitLab Runners Docker API"}]}
{"openapi":"3.0.3","info":{"title":"runrs","description":"A microservice to manage GitLab Runners in Docker via REST","contact":{"name":"bmc"},"license":{"name":"Apache-2.0"},"version":"0.6.2"},"servers":[{"url":"http://0.0.0.0:3000/","description":"Local development server"}],"paths":{"/gitlab-runners":{"post":{"tags":["gitlab_runners"],"operationId":"create","requestBody":{"description":"GitLabRunner to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}},"required":true},"responses":{"201":{"description":"Created new GitLab Runner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"400":{"description":"GitLab Runner already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gitlab-runners/list":{"get":{"tags":["gitlab_runners"],"operationId":"list","responses":{"200":{"description":"Read all GitLabRunners","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gitlab-runners/{uuid}":{"get":{"tags":["gitlab_runners"],"operationId":"read","parameters":[{"name":"uuid","in":"path","description":"GitLabRunner UUID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Read all GitLabRunners","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gitlab_runners"],"operationId":"update","parameters":[{"name":"uuid","in":"path","description":"GitLab Runner UUID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"GitLabRunner to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}},"required":true},"responses":{"200":{"description":"Updated GitLabRunner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"204":{"description":"GitLabRunner already up-to-date"},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gitlab_runners"],"operationId":"delete","parameters":[{"name":"uuid","in":"path","description":"GitLabRunner UUID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted GitLabRunner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabRunner"}}}},"404":{"description":"GitLabRunner not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["err_type","msg"],"properties":{"err_type":{"$ref":"#/components/schemas/ErrorType"},"msg":{"type":"string"}}},"ErrorType":{"type":"string","enum":["ConnectionFailed","InvalidArgument","AlreadyExists","Forbidden","Unchanged","NotFound","BadRequest","InternalError","Unimplemented","Other"]},"GitLabRunner":{"type":"object","description":"Public API for configuring a single CI/CD job executor, not the GitLab Runner service.\n\nGitLab publish a service binary they refer to as \"GitLab Runner\". You can install it locally or\non you server [as per its documentation](https://docs.gitlab.com/runner/install/). This binary\nis, however, *not* the CI/CD job executor; rather, it _manages_ the executors. As such, when you\n\"register a runner\" (as per [their documentation](https://docs.gitlab.com/runner/register/)),\nyou use the `gitlab-runner` binary to do so.\n\nThe `GitLabRunner` struct replicates the API of the `gitlab-runner` binary, albeit exposing a\nsmaller configuration surface. In other words: if you run `gitlab-runner register --help`, you\nget a list of options. We support a subset of those options, and those which are supported are\nnamed the same here as they are in `gitlab-runner`, except in `snake_case` instead of\n`kebab-case`. For example, `--docker-image` becomes `docker_image`.","required":["id","url","token","docker_image"],"properties":{"docker_image":{"type":"string","description":"Docker image to be used","example":"alpine:latest"},"id":{"type":"integer","format":"int32","description":"ID of the runner within the GitLab instance; unique for that GitLab instance","minimum":0},"name":{"type":"string","description":"Runner name (default: Docker-style random name)","example":"usain-bolt"},"token":{"type":"string","description":"Runner token, obtained from the GitLab instance. See [documentation of the `glrcfg`\ncrate](https://docs.rs/glrcfg/latest/glrcfg/runner/struct.RunnerToken.html) for details.","example":"glrt-0123456789_abcdefXYZ"},"token_obtained_at":{"type":"string","format":"date-time","example":"2023-08-23T23:23:23Z"},"url":{"type":"string","format":"uri","description":"GitLab instance URL","example":"https://gitlab.your-company.com"},"uuid":{"type":"string","format":"uuid","example":"be924fdd-fb28-468c-8c70-1f0ed3af4485"}}}},"securitySchemes":{"api_token":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"security":[{"api_token":[]}],"tags":[{"name":"runrs","description":"GitLab Runners Docker API"}]}

0 comments on commit 5cbba4a

Please sign in to comment.