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

docs: AWS codebuild: Avoid branch names like main~3. #919

Merged

Conversation

janpapenbrock
Copy link
Contributor

@janpapenbrock janpapenbrock commented Jan 3, 2025

When the main branch has advanced compared to the currently checked out commit,git name-rev will print e.g. main~3.

To keep Cypress branch names clean, we want COMMIT_INFO_BRANCH to be just main, though.

Therefore, I suggest cutting off the suffix.


If this gets merged, I believe the docs have to be afterwards updated in multiple places, too, e.g. here: https://github.com/cypress-io/cypress-documentation/blob/main/docs/app/continuous-integration/aws-codebuild.mdx

I could do that, too, if desired, but of course don't have an overview of all the correct places.

@CLAassistant
Copy link

CLAassistant commented Jan 3, 2025

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399
Copy link
Collaborator

@janpapenbrock

Thanks for your PR!

Please change your commit message to start with docs: rather than fix: as the files you propose to change are not actually run in this repo, they are documentation only for AWS Codebuild. The same applies to your other PR #920.

If you have a public example using your amended AWS Codebuild workflow successfully running, that would be very helpful for review.

See https://github.com/cypress-io/cypress-example-kitchensink/blob/master/README.md#ci-workflow-examples

This table shows additional examples of CI workflows. With the exception of GitHub Actions workflows, these are not live examples as in the table above and they may require modification before use.

I don't know why the CircleCI Pipeline is failing. That would need to be looked at by the Cypress.io team who have access to the CircleCI account.

@janpapenbrock janpapenbrock force-pushed the fix/codebuild-commit-branch branch 2 times, most recently from fdea6f1 to c28e7e5 Compare January 3, 2025 12:19
…h has advanced compared to current commit. Fixes `main~3` to become `main` instead.
@janpapenbrock janpapenbrock force-pushed the fix/codebuild-commit-branch branch from c28e7e5 to 8da1c0a Compare January 3, 2025 12:20
@MikeMcC399
Copy link
Collaborator

@janpapenbrock

You should probably also change the title of the PR

fix: Avoid branches like main~3 for AWS codebuild

as well. ( fix: -> docs:)

@janpapenbrock janpapenbrock changed the title fix: Avoid branches like main~3 for AWS codebuild docs: AWS codebuild: Avoid branch names like main~3. Jan 3, 2025
@janpapenbrock
Copy link
Contributor Author

Changed commit message and PR title.


I even had some brackets wrong in the code, which I have now fixed.


I don't have a public workflow available.

The changes are somewhat testable in a shell, when "mocking" the output of git rev-parse HEAD | xargs git name-rev and leaving everything else the same:

#!/bin/bash

git_name_rev_output="some-hash remotes/origin/main~3"

# old code
export COMMIT_INFO_BRANCH="$(echo "$git_name_rev_output" | cut -d' ' -f2 | sed 's/remotes\/origin\///g')"
echo "old: $COMMIT_INFO_BRANCH"

# new code
export COMMIT_INFO_BRANCH="$(echo "$git_name_rev_output" | cut -d' ' -f2 | sed 's/remotes\/origin\///g' | sed 's/~.\+$//g')"
echo "new: $COMMIT_INFO_BRANCH"

Prints:

old: main~3
new: main

@jennifer-shehane jennifer-shehane merged commit 24af18c into cypress-io:master Jan 6, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants