mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-01 18:26:25 +08:00
Replace delete opt on GitHub bootstrap with curl
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
12
.github/workflows/bootstrap.yaml
vendored
12
.github/workflows/bootstrap.yaml
vendored
@ -68,12 +68,12 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
|
||||||
- name: delete repository
|
- name: delete repository
|
||||||
run: |
|
run: |
|
||||||
/tmp/flux bootstrap github --manifests ./manifests/install/ \
|
curl \
|
||||||
--owner=fluxcd-testing \
|
-X DELETE \
|
||||||
--repository=flux-test-${{ steps.vars.outputs.sha_short }} \
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
--branch=main \
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
--path=test-cluster \
|
--fail --silent \
|
||||||
--delete
|
https://api.github.com/repos/fluxcd-testing/flux-test-${{ steps.vars.outputs.sha_short }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
|
||||||
- name: Debug failure
|
- name: Debug failure
|
||||||
|
|||||||
@ -80,7 +80,6 @@ type githubFlags struct {
|
|||||||
hostname string
|
hostname string
|
||||||
path flags.SafeRelativePath
|
path flags.SafeRelativePath
|
||||||
teams []string
|
teams []string
|
||||||
delete bool
|
|
||||||
sshHostname string
|
sshHostname string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,9 +100,6 @@ func init() {
|
|||||||
bootstrapGitHubCmd.Flags().StringVar(&githubArgs.sshHostname, "ssh-hostname", "", "GitHub SSH hostname, to be used when the SSH host differs from the HTTPS one")
|
bootstrapGitHubCmd.Flags().StringVar(&githubArgs.sshHostname, "ssh-hostname", "", "GitHub SSH hostname, to be used when the SSH host differs from the HTTPS one")
|
||||||
bootstrapGitHubCmd.Flags().Var(&githubArgs.path, "path", "path relative to the repository root, when specified the cluster sync will be scoped to this path")
|
bootstrapGitHubCmd.Flags().Var(&githubArgs.path, "path", "path relative to the repository root, when specified the cluster sync will be scoped to this path")
|
||||||
|
|
||||||
bootstrapGitHubCmd.Flags().BoolVar(&githubArgs.delete, "delete", false, "delete repository (used for testing only)")
|
|
||||||
bootstrapGitHubCmd.Flags().MarkHidden("delete")
|
|
||||||
|
|
||||||
bootstrapCmd.AddCommand(bootstrapGitHubCmd)
|
bootstrapCmd.AddCommand(bootstrapGitHubCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,14 +159,6 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
if githubArgs.delete {
|
|
||||||
if err := provider.DeleteRepository(ctx, repository); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
logger.Successf("repository deleted")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// create GitHub repository if doesn't exists
|
// create GitHub repository if doesn't exists
|
||||||
logger.Actionf("connecting to %s", githubArgs.hostname)
|
logger.Actionf("connecting to %s", githubArgs.hostname)
|
||||||
changed, err := provider.CreateRepository(ctx, repository)
|
changed, err := provider.CreateRepository(ctx, repository)
|
||||||
|
|||||||
Reference in New Issue
Block a user