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

Support to deploy specific image #1507

Merged
merged 1 commit into from
Jul 12, 2024
Merged

Conversation

kenhys
Copy link
Contributor

@kenhys kenhys commented Jul 11, 2024

Before:

when tagged, it deploy all images

After:

Allow to deploy specific image with tag

  • tag v1.17.0-1.n => deploy all images
  • tag v1.17.0-debian-graylog-1.n => deploy only graylog images

@kenhys
Copy link
Contributor Author

kenhys commented Jul 12, 2024

example.

https://github.com/kenhys/fluentd-kubernetes-daemonset/actions/runs/9888071990

  • all amd64 and arm64 job must succeed to execute manifest jobs.
    • If amd64 or arm64 job was failed, manifest job will not be kicked. so amd64 arm64 job does not exit 1 even though component is not matched with specified tag.
  • It seems that most of manifest jobs are failed, but it succeeds with about graylog manifest.

image

@kenhys kenhys requested a review from daipom July 12, 2024 02:07
@kenhys kenhys mentioned this pull request Jul 12, 2024
@kenhys kenhys removed the request for review from daipom July 12, 2024 02:17
@kenhys
Copy link
Contributor Author

kenhys commented Jul 12, 2024

need to reconsider define-matrix.
I'll fix it.

@kenhys kenhys force-pushed the publish-specific branch from 1654f63 to 0c87930 Compare July 12, 2024 02:47
@kenhys kenhys requested a review from daipom July 12, 2024 03:00
@kenhys
Copy link
Contributor Author

kenhys commented Jul 12, 2024

Simplified now.

  1. deploy specific image with tag v1.17.0-debian-graylog-1.2

https://github.com/kenhys/fluentd-kubernetes-daemonset/actions/runs/9901671261

image

  1. deploy all image with tag v1.17.0-1.2

https://github.com/kenhys/fluentd-kubernetes-daemonset/actions/runs/9901705884

image

@daipom
Copy link
Contributor

daipom commented Jul 12, 2024

Thanks!
This looks good to me, but I thought it would be better if it could be more abstract logic, such as not depending on debian-* or -f1-2.

It was my fault. I'm Sorry for this.
Looking back on #1496, I found there was a needless process.
In the first place, we didn't need the bash logic.
We could output the components for the matrix very simply as follows:

    env:
      ALL_COMPONENTS: >
        [
        "debian-azureblob",
        "debian-cloudwatch",
        "debian-elasticsearch7",
        "debian-elasticsearch8",
        "debian-forward",
        "debian-gcs",
        "debian-graylog",
        "debian-kafka",
        "debian-kafka2",
        "debian-kinesis",
        "debian-logentries",
        "debian-loggly",
        "debian-logzio",
        "debian-opensearch",
        "debian-papertrail",
        "debian-s3",
        "debian-syslog"
        ]
    outputs:
      components: ${{ env.ALL_COMPONENTS }}

Based on this, how about outputting only the component if its name is included in the tag?

  define-matrix:
    runs-on: ubuntu-latest
    env:
      ALL_COMPONENTS: >
        [
        "debian-azureblob",
        "debian-cloudwatch",
        "debian-elasticsearch7",
        "debian-elasticsearch8",
        "debian-forward",
        "debian-gcs",
        "debian-graylog",
        "debian-kafka",
        "debian-kafka2",
        "debian-kinesis",
        "debian-logentries",
        "debian-loggly",
        "debian-logzio",
        "debian-opensearch",
        "debian-papertrail",
        "debian-s3",
        "debian-syslog"
        ]
    outputs:
      components: >
        ${{ steps.arrange-components.outputs.for_all == 'true' && env.ALL_COMPONENTS
        || format('["{0}"]', steps.arrange-components.outputs.component) }}
    steps:
      - id: arrange-components
        run: |
          echo "for_all=true" >> "$GITHUB_OUTPUT"
          for component in ${{ join(fromJSON(env.ALL_COMPONENTS), ' ') }}; do
            if [[ ${{ env.github.ref_name }} == *"$component"* ]]; then
              echo "for_all=false" >> "$GITHUB_OUTPUT"
              echo "component=$component" >> "$GITHUB_OUTPUT"
              break
            fi
          done

@daipom
Copy link
Contributor

daipom commented Jul 12, 2024

Based on this, how about outputting only the component if its name is included in the tag?

I have checked this works.

Before:

when tagged, it deploy all images

After:

Allow to deploy specific image with tag

* tag v1.17.0-1.n => deploy all images
* tag v1.17.0-debian-graylog-1.n => deploy graylog images

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
@kenhys kenhys force-pushed the publish-specific branch from 0c87930 to 46194a3 Compare July 12, 2024 09:21
Copy link
Contributor

@daipom daipom left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@kenhys kenhys merged commit 4344979 into fluent:master Jul 12, 2024
1 check passed
@kenhys kenhys deleted the publish-specific branch July 12, 2024 09:28
kenhys added a commit to kenhys/fluentd-kubernetes-daemonset that referenced this pull request Jul 12, 2024
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
kenhys added a commit that referenced this pull request Jul 12, 2024
Backport #1507 to deploy specific image for v1.16
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.

2 participants