|
|
@@ -46,7 +46,6 @@ func NewCreateReleaseHandler(
|
|
|
|
|
|
func (c *CreateReleaseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
user, _ := r.Context().Value(types.UserScope).(*models.User)
|
|
|
- proj, _ := r.Context().Value(types.ProjectScope).(*models.Project)
|
|
|
cluster, _ := r.Context().Value(types.ClusterScope).(*models.Cluster)
|
|
|
namespace := r.Context().Value(types.NamespaceScope).(string)
|
|
|
operationID := oauth.CreateRandomState()
|
|
|
@@ -166,7 +165,6 @@ func (c *CreateReleaseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
|
|
if request.GithubActionConfig != nil {
|
|
|
_, _, err := createGitAction(
|
|
|
c.Config(),
|
|
|
- proj,
|
|
|
user.ID,
|
|
|
cluster.ProjectID,
|
|
|
cluster.ID,
|
|
|
@@ -245,7 +243,6 @@ func createReleaseFromHelmRelease(
|
|
|
|
|
|
func createGitAction(
|
|
|
config *config.Config,
|
|
|
- project *models.Project,
|
|
|
userID, projectID, clusterID uint,
|
|
|
request *types.CreateGitActionConfigRequest,
|
|
|
name, namespace string,
|
|
|
@@ -287,7 +284,7 @@ func createGitAction(
|
|
|
|
|
|
// if this isn't a dry run, generate the token
|
|
|
if !isDryRun {
|
|
|
- encoded, err = getToken(config, project, userID, projectID, clusterID, request)
|
|
|
+ encoded, err = getToken(config, userID, projectID, clusterID, request)
|
|
|
|
|
|
if err != nil {
|
|
|
return nil, nil, err
|
|
|
@@ -368,7 +365,6 @@ func createGitAction(
|
|
|
|
|
|
func getToken(
|
|
|
config *config.Config,
|
|
|
- proj *models.Project,
|
|
|
userID, projectID, clusterID uint,
|
|
|
request *types.CreateGitActionConfigRequest,
|
|
|
) (string, error) {
|
|
|
@@ -454,10 +450,6 @@ func getToken(
|
|
|
SecretKey: hashedToken,
|
|
|
}
|
|
|
|
|
|
- if !proj.APITokensEnabled {
|
|
|
- return "", fmt.Errorf("api tokens are not enabled for this project")
|
|
|
- }
|
|
|
-
|
|
|
apiToken, err = config.Repo.APIToken().CreateAPIToken(apiToken)
|
|
|
|
|
|
if err != nil {
|