Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add services support #5

Merged
merged 11 commits into from
Jun 26, 2024
Merged

Conversation

pauldoomgov
Copy link
Contributor

@pauldoomgov pauldoomgov commented Jun 11, 2024

Addresses https://github.com/GSA-TTS/devtools-program/issues/47

  • Launches services as separate applications with the same initial name as the "worker" instances
  • Creates a route in the apps.internal domain to allow the main worker to connect to the service(s)
  • Adds a network policy to allow access from the worker to the service(s)
  • Allows each worker to have separate services, avoiding collision
  • Cleans up after itself like a responsible runner

Here is some selected output using this .gitlab-ci.yml showing an "echo" service being contacted from an main worker step:

[cf-driver] Using SSH to connect to glrw-r34277582-p56364419-c0-j7131131154 and run steps$ curl http://${SERVICE_PREFIX}echo.apps.internal:8080
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0{
  "path": "/",
  "headers": {
    "host": "glrw-r34277582-p56364419-c0-j7131131154-svc-echo.apps.internal:8080",
    "user-agent": "curl/7.81.0",
    "accept": "*/*"
  },
  "method": "GET",
  "body": "",
  "fresh": false,
  "hostname": "glrw-r34277582-p56364419-c0-j7131131154-svc-echo.apps.internal",
  "ip": "10.255.19.225",
  "ips": [],
  "protocol": "http",
  "query": {},
  "subdomains": [
    "glrw-r34277582-p56364419-c0-j7131131154-svc-echo"
  ],
  "xhr": false,
  "os": {
    "hostname": "0178ff2e-18a1-45e5-55ba-09ce"
  },
  "connection": {}

For context, the relevant .gitlab-ci.yml:

variables:
  SERVICE_PREFIX: "glrw-r$CI_RUNNER_ID-p$CI_PROJECT_ID-c$CI_CONCURRENT_PROJECT_ID-j$CI_JOB_ID-svc-"
stages:
- test
echo-test-job:
  stage: test
  services:
  - name: mendhak/http-https-echo:latest
    alias: echo
  script:
  - curl http://${SERVICE_PREFIX}echo.apps.internal:8080

@pauldoomgov pauldoomgov marked this pull request as draft June 11, 2024 15:57
@pauldoomgov pauldoomgov marked this pull request as ready for review June 18, 2024 22:17
Copy link
Contributor

@zjrgov zjrgov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very neat! LGTM

runner/cf-driver/cleanup.sh Outdated Show resolved Hide resolved
runner/cf-driver/cleanup.sh Show resolved Hide resolved
runner/cf-driver/cleanup.sh Outdated Show resolved Hide resolved
runner/cf-driver/prepare.sh Outdated Show resolved Hide resolved
runner/cf-driver/prepare.sh Show resolved Hide resolved
runner/cf-driver/prepare.sh Outdated Show resolved Hide resolved
@pburkholder
Copy link
Contributor

Just an update on where I am with reviewing this. A few months ago I worked through the tutorial "DevOps with GitLab CI Course - Build Pipelines and Deploy to AWS" -- and I finally got around to cleaning up the leftover resources on AWS and cloud.gov for this, and eliminating the bitrot. So it now deploys to https://peterb-gl-proud-wombat-qc.app.cloud.gov/ when using the GitLab instance runners.

But when I switch from GitLab Instance Runners to the cloud.gov Runner-Manager in peterb-runner the deployment fails trying to use the CF-CLI docker image:

[cf-driver] Installing dependencies into runner-38480029-project-54365529-concurrent-0-7150019953
[cf-driver] Ensuring git, git-lfs, and curl are installed
Required packages missing and I do not know what to do about it
ERROR: Job failed: exit status 1

... so, just naively switching from instance runners to project runners on cloud.gov is not turnkey. I'll work on this more in the morning.

@pauldoomgov pauldoomgov force-pushed the pauldoom/soa-service-oriented-anarchy branch from e4b5c95 to 80f2ead Compare June 25, 2024 22:05
@pauldoomgov
Copy link
Contributor Author

Just an update on where I am with reviewing this. A few months ago I worked through the tutorial "DevOps with GitLab CI Course - Build Pipelines and Deploy to AWS" -- and I finally got around to cleaning up the leftover resources on AWS and cloud.gov for this, and eliminating the bitrot. So it now deploys to https://peterb-gl-proud-wombat-qc.app.cloud.gov/ when using the GitLab instance runners.

But when I switch from GitLab Instance Runners to the cloud.gov Runner-Manager in peterb-runner the deployment fails trying to use the CF-CLI docker image:

[cf-driver] Installing dependencies into runner-38480029-project-54365529-concurrent-0-7150019953
[cf-driver] Ensuring git, git-lfs, and curl are installed
Required packages missing and I do not know what to do about it
ERROR: Job failed: exit status 1

... so, just naively switching from instance runners to project runners on cloud.gov is not turnkey. I'll work on this more in the morning.

Created issue to track this: #9

@pauldoomgov pauldoomgov merged commit 11f09a7 into main Jun 26, 2024
anna-m-gsa pushed a commit that referenced this pull request Aug 5, 2024
* Launches services as separate applications with the same initial name as the "worker" instances
* Creates a route in the apps.internal domain to allow the main worker to connect to the service(s)
* Adds a network policy to allow access from the worker to the service(s)
* Allows each worker to have separate services, avoiding collision
* Cleans up after itself like a responsible runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants