Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Sanitize Branch Names for Docker Containers #10366

Closed
wants to merge 41 commits into from
Closed

Conversation

kj4ezj
Copy link
Contributor

@kj4ezj kj4ezj commented May 15, 2021

Change Description

From #help-automation and AUTO-848, a developer created an eos branch name with a hash tag # character (e.g. "pr#125"). This broke the Docker - Build and Install step because it requires branch names to be valid URIs, currently only transforming forward-slashes / into underscores _ to support branch names with forward-slashes.

This pull request adds a series of transforms to turn forward-slashes / into underscores _, turn all other invalid characters for a docker container name into dashes -, then minimize sequences of these replacement characters and ensure they are not the beginning or end of the string.

I have also added log folding groups and improved the patterns in /.cicd/create-docker-from-binary.sh, and updated the pipeline readme.

See Also

Change Type

Select ONE:

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Testing Changes

Select ANY that apply:

  • New Tests
  • Existing Tests
  • Test Framework
  • CI System
  • Other

Consensus Changes

  • Consensus Changes

None.

API Changes

  • API Changes

None.

Documentation Additions

  • Documentation Additions

None.

@kj4ezj kj4ezj changed the title Sanitize Branch Names for Docker Container Names Sanitize Branch Names for Docker Containers May 15, 2021
@kj4ezj
Copy link
Contributor Author

kj4ezj commented May 17, 2021

Closed in favor of pull request 10372 because buildkite-agent is trying to perform interpolation on the branch name in the pipeline.yml here:

  - label: ":chains: Sync from Genesis Test"
    trigger: "eosio-sync-from-genesis"
    async: false
    if: build.env("BUILDKITE_TAG") == null
    build:
      message: "Triggered by eosio build 28443"
      commit: "53323023b0707fdd5bd26947781b92251af77f95"
      branch: "zach-_=+#/@&$#Ω"
      env:
        BUILDKITE_TRIGGERED_FROM_BUILD_URL: "https://buildkite.com/EOSIO/eosio/builds/28443"
        SKIP_JUNGLE: "true"
        SKIP_KYLIN: ""
        SKIP_MAIN: ""
        TIMEOUT: ""

  - label: ":outbox_tray: Resume from State Test"
    trigger: "eosio-resume-from-state"
    async: false
    if: build.env("BUILDKITE_TAG") == null
    build:
      message: "Triggered by eosio build 28443"
      commit: "53323023b0707fdd5bd26947781b92251af77f95"
      branch: "zach-_=+#/@&$#Ω"
      env:
        BUILDKITE_TRIGGERED_FROM_BUILD_URL: "https://buildkite.com/EOSIO/eosio/builds/28443"
        SKIP_JUNGLE: "true"
        SKIP_KYLIN: ""
        SKIP_MAIN: ""
        TIMEOUT: ""

  - wait:
    continue_on_failure: true

This is, in my opinion, a bug on Buildkite's end because valid branch names can apparently contain a $ character followed by other characters that could look like an identifier. I don't think buildkite-agent should perform shell interpolation on the git branch or tag strings, where they exist. Buildkite does offer the --no-interpolation flag to mitigate this, but converting this pipeline to use envsubst for interpolation is perhaps a bit more work than I had planned to do for this service item.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant