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

ref(ci): consolidate cached states workflows and scripts #8865

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Conversation

gustavovalverde
Copy link
Member

@gustavovalverde gustavovalverde commented Sep 12, 2024

Motivation

We've been using multiple approaches to locate and retrieve cached states in GCP. However, this has made it difficult to reuse the same methods across new workflows or different scenarios.

To address this, we've streamlined the process to make it more reusable in other contexts. This change will support deploying instances from both the main branch and release, simplifying future implementations and speeding up the process.

Specifications & References

This is the ground work for:

Solution

  • Use a single bash script (gcp-get-cached-disks.sh) to get cached states names and availability
  • Move script logic from sub-find-cached-disks.yml to gcp-get-cached-disks.sh and adapt sub-find-cached-disks.yml to allow to output available disks and disks names.
  • Simplify parameters usage in sub-deploy-integration-tests-gcp.yml and convert the Find ${{ inputs.test_id }} cached state disk step into an independent job, to be able to use the sub-find-cached-disks.yml reusable workflow
  • Remove repetition in sub-ci-integration-tests-gcp.yml
  • Allow sync tests to use the ZEBRA_CACHED_STATE_DIR as the cache directory, if specified
  • Update the entrypoint.sh to reflect this change
  • Add the ZEBRA_CACHED_STATE_DIR variable to the missing tests in sub-ci-integration-tests-gcp.yml, and remove extra parameters to call reusable workflows.

Tests

All test should find their respective cached states and run sucessfully

Follow-up Work

PR Author's Checklist

  • The PR name will make sense to users.
  • The PR provides a CHANGELOG summary.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.

PR Reviewer's Checklist

  • The PR Author's checklist is complete.
  • The PR resolves the issue.

@gustavovalverde gustavovalverde added A-infrastructure Area: Infrastructure changes A-devops Area: Pipelines, CI/CD and Dockerfiles I-usability Zebra is hard to understand or use C-tech-debt Category: Code maintainability issues P-High 🔥 labels Sep 12, 2024
@gustavovalverde gustavovalverde self-assigned this Sep 12, 2024
@gustavovalverde gustavovalverde requested a review from a team as a code owner September 12, 2024 09:44
@gustavovalverde gustavovalverde requested review from upbqdn and removed request for a team September 12, 2024 09:44
@gustavovalverde gustavovalverde marked this pull request as draft September 12, 2024 09:44
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Sep 12, 2024
@gustavovalverde gustavovalverde marked this pull request as ready for review September 13, 2024 11:29
@gustavovalverde gustavovalverde requested a review from a team as a code owner September 16, 2024 09:22
We've been using multiple approaches to locate and retrieve cached states in GCP. However, this has made it difficult to reuse the same methods across new workflows or different scenarios.

To address this, we've streamlined the process to make it more reusable in other contexts. This change will support deploying instances from both the `main` branch and `release`, simplifying future implementations and speeding up the process.

Changes:
- Use a single bash script (`gcp-get-cached-disks.sh`) to get cached states names and availability
- Move script logic from `sub-find-cached-disks.yml` to `gcp-get-cached-disks.sh` and adapt `sub-find-cached-disks.yml` to allow to output available disks and disks names.
- Simplify parameters usage in `sub-deploy-integration-tests-gcp.yml` and convert the `Find ${{ inputs.test_id }} cached state disk` step into an independent job, to be able to use the `sub-find-cached-disks.yml` reusable workflow
- Remove repetition in `sub-ci-integration-tests-gcp.yml`
We had a technical debt with some tests using a hardcoded value for the cache directory (`/zebrad-cache`), which generated inconsistency across disks and cached states directories.

Changes:
- Allow sync tests to use the `ZEBRA_CACHED_STATE_DIR` as the cache directory, if specified
- Update the `entrypoint.sh` to reflect this change
- Add the `ZEBRA_CACHED_STATE_DIR` variable to the missing tests in `sub-ci-integration-tests-gcp.yml`, and remove extra parameters to call reusable workflows.
@gustavovalverde gustavovalverde changed the title ref(ci): consolidate workflows and scripts for cached states ref(ci): ref(ci): consolidate cached states workflows and scripts Sep 16, 2024
@gustavovalverde gustavovalverde changed the title ref(ci): ref(ci): consolidate cached states workflows and scripts ref(ci): consolidate cached states workflows and scripts Sep 16, 2024
@gustavovalverde
Copy link
Member Author

I'm not certain if I should worry about this warning:

2024-09-16T13:37:54.535314Z  WARN zebra_state::service::finalized_state::disk_db: could not canonicalize "/var/cache/zebrad-cache/state/v25/mainnet": No such file or directory (os error 2)

@oxarbitrage
Copy link
Contributor

I'm not certain if I should worry about this warning:

2024-09-16T13:37:54.535314Z WARN zebra_state::service::finalized_state::disk_db: could not canonicalize "/var/cache/zebrad-cache/state/v25/mainnet": No such file or directory (os error 2)

I saw this in different recent pull requests, i think we should open a new ticket for this one.

Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

Looks really good to me in general, i left a few questions.

zebrad/tests/acceptance.rs Show resolved Hide resolved
zebrad/tests/acceptance.rs Show resolved Hide resolved
@mergify mergify bot merged commit aec07f2 into main Sep 19, 2024
205 checks passed
@mergify mergify bot deleted the ref-cache-state branch September 19, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles A-infrastructure Area: Infrastructure changes C-tech-debt Category: Code maintainability issues C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG I-usability Zebra is hard to understand or use P-High 🔥
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants