Skip to content

Conversation

@DexterYan
Copy link
Contributor

@DexterYan DexterYan commented Feb 27, 2025

  1. based on our current api
https://api.replicated.com/vendor/v3/app/{appID}/channel/{channelID}/releases

We will get

{
    "releases": [
        {
            "sequence": 3,
            "channelId": "2S2KBVlykOhpCxSCPSMMh5qCqtP",
            ....
            "airgapBuildStatus": "built",
         }

This new function is helping to poll the airgap build status.

  1. add buildAirgapAutomatically for channel channel
  2. tests and example added
  3. tested with npm run poll-airgap -- with real channel

sc-120957

@nvanthao
Copy link
Member

nvanthao commented Mar 6, 2025

example added, e.g. to run

npm run poll-airgap -- <app-id> <channel-id> <release-sequence> <status>

@DexterYan
Copy link
Contributor Author

I have removed console.debug(Airgapped build release body: ${JSON.stringify(body)});
It will print the whole body, which is not easy for reading and not useful for debug.

@DexterYan
Copy link
Contributor Author

Test with my own channel, works fine.

 npm run poll-airgap -- 

Copy link
Member

@jdewinne jdewinne left a comment

Choose a reason for hiding this comment

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

I think this should go into channel.ts, as the airgap bundle is created on promotion of a release to a channel. At least that is when I think it happens.

Copy link
Member

Choose a reason for hiding this comment

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

Should the changes be in channels.ts, as this is about a release promoted to a channel and not an "Application" release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I have moved the function back to channels.ts

src/releases.ts Outdated
export interface Release {
sequence: string;
charts?: ReleaseChart[];
airgapBuildStatus?: string;
Copy link
Member

Choose a reason for hiding this comment

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

I think this might become confusing? The Release sequence is not the same as the Channel release sequence?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a problem. Let me think a way to reduce the confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added channelSequence to avoid the confusing part

Copy link
Member

Choose a reason for hiding this comment

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

I don't think is correct. A release can be promoted to multiple channels, and each channel maintains its own sequence numbers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

channelSequence is misunderstanding. I have renamed it to promotedChannelSequence.

Yes, release can be promoted to multiple channels. But in getAirgapBuildRelease function, we have filtered by channel ID. In this case, the promotedChannelSequence will be only one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example,
when we curl

https://api.replicated.com/vendor/v3/app/2S2KBYYp3fKkP42pb3eJYIYJNYv/channel/2pusnQ3dbpDq0SEVEE8LCeUCCwC/releases

we will get

{
    "releases": [
      {
            "sequence": 37,
            "channelId": "2pusnQ3dbpDq0SEVEE8LCeUCCwC",
            "channelName": "Unstable",
            "channelIcon": "",
            "channelSequence": 10,
            "semver": "0.2.5",
            "isRequired": false,
       }
}

That is where channelSequence comes from "channelSequence": 10,
But it is confusing. Do you have suggestions, or should we make it like

export interface Release {
  sequence: string;
  channels?: Channel[];
  charts?: ReleaseChart[];
  airgapBuildStatus?: string;
}

to make it same as current api

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be in channels.ts and not in releases.ts.
The class Channel should probably contain an array of ChannelReleases, and ChannelRelease should be a new class in channel.ts

Choose a reason for hiding this comment

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

I think it should be in channels.ts and not in releases.ts.
The class Channel should probably contain an array of ChannelReleases, and ChannelRelease should be a new class in channel.ts

fwiw - this sounds right to me. A "channel release" is an object that belongs to "channel". It would also mirror what we've done in places like replicated cli -

https://github.com/replicatedhq/replicated/blob/af2aea0904ce8fdfe92f06f0bef674ceb5a51247/pkg/types/channel.go#L65

which is then used in the larger channel obj:

https://github.com/replicatedhq/replicated/blob/af2aea0904ce8fdfe92f06f0bef674ceb5a51247/pkg/types/channel.go#L27

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @jdewinne and @pandemicsyn! ChannelRelease makes more sense. I have added it into channel.ts

@DexterYan DexterYan requested a review from nvanthao March 17, 2025 05:19
@DexterYan DexterYan requested a review from pandemicsyn March 19, 2025 02:56
@jdewinne jdewinne merged commit e01682d into main Mar 19, 2025
2 checks passed
@jdewinne jdewinne deleted the dx/sc-118481/add-poll-airgap-build-status branch March 19, 2025 16:53
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