Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

add arm64 targets and update mm deps to 6.0.2 #402

Merged
merged 5 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 3 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ executors:
default:
working_directory: ~/go/src/github.com/mattermost/mmctl
docker:
- image: circleci/golang:1.17.0
- image: cimg/go:1.17.2

aliases:
- &restore_cache
Expand All @@ -19,37 +19,6 @@ aliases:
paths:
- "/go/pkg/mod"

commands:
install-golangci-lint:
description: Install golangci-lint
parameters:
version:
type: string
default: 1.42.0
gobin:
type: string
default: /go/bin
prefix:
type: string
default: v2
description: Prefix for cache key to store the binary.
steps:
- restore_cache:
name: Restore golangci-lint cache
keys: ['<< parameters.prefix >>-golangci-lint-{{ arch }}-<< parameters.version >>']
- run:
name: Install golangci-lint
command: |
mkdir -p << parameters.gobin >>
command -v << parameters.gobin >>/golangci-lint && exit

download=https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
wget -O- -q $download | sh -s -- -b << parameters.gobin >>/ v<< parameters.version >>
- save_cache:
name: Save golangci-lint cache
key: '<< parameters.prefix >>-golangci-lint-{{ arch }}-<< parameters.version >>'
paths: [<< parameters.gobin >>/golangci-lint]

jobs:
docs:
executor:
Expand All @@ -63,13 +32,10 @@ jobs:
if [[ -n $(git status --porcelain) ]]; then echo "Please update the docs using make docs"; exit 1; fi

lint:
executor:
name: default
docker:
- image: golangci/golangci-lint:v1.42.1
steps:
- checkout
- attach_workspace:
at: ~/go/mattermost/
- install-golangci-lint
- run:
name: "Validate lint"
command: |
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docs:

lint:
stage: test
image: $CI_REGISTRY/mattermost/ci/images/golangci-lint:v1.31.0-1
image: docker.io/golangci/golangci-lint:v1.42.1
script:
- echo "Installing mattermost-govet"
- GO111MODULE=off go get -u github.com/mattermost/mattermost-govet
Expand Down
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ linters:
enable:
- deadcode
- gofmt
- golint
- revive
- gosimple
- govet
- ineffassign
Expand All @@ -44,7 +44,6 @@ linters:
- gocyclo
- goimports
- gosec
- interfacer
- misspell
- nakedret
- staticcheck
Expand Down
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,39 @@ endif

.PHONY: build
build: vendor check
go build -ldflags '$(LDFLAGS)' -mod=vendor
go build -trimpath -ldflags '$(LDFLAGS)' -mod=vendor
md5sum < mmctl | cut -d ' ' -f 1 > mmctl.md5.txt

.PHONY: install
install: vendor check
go install -ldflags '$(LDFLAGS)' -mod=vendor
go install -trimpath -ldflags '$(LDFLAGS)' -mod=vendor

.PHONY: package
package: vendor
mkdir -p build

@echo Build Linux amd64
env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -mod=vendor
env GOOS=linux GOARCH=amd64 go build -trimpath -ldflags '$(LDFLAGS)' -mod=vendor
tar cf build/linux_amd64.tar mmctl
md5sum < build/linux_amd64.tar | cut -d ' ' -f 1 > build/linux_amd64.tar.md5.txt

@echo Build Linux arm64
env GOOS=linux GOARCH=arm64 go build -trimpath -ldflags '$(LDFLAGS)' -mod=vendor
tar cf build/linux_arm64.tar mmctl
md5sum < build/linux_arm64.tar | cut -d ' ' -f 1 > build/linux_arm64.tar.md5.txt

@echo Build OSX amd64
env GOOS=darwin GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -mod=vendor
env GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags '$(LDFLAGS)' -mod=vendor
tar cf build/darwin_amd64.tar mmctl
md5sum < build/darwin_amd64.tar | cut -d ' ' -f 1 > build/darwin_amd64.tar.md5.txt

@echo Build OSX arm64
env GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags '$(LDFLAGS)' -mod=vendor
tar cf build/darwin_arm64.tar mmctl
md5sum < build/darwin_arm64.tar | cut -d ' ' -f 1 > build/darwin_arm64.tar.md5.txt

@echo Build Windows amd64
env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -mod=vendor
env GOOS=windows GOARCH=amd64 go build -trimpath -ldflags '$(LDFLAGS)' -mod=vendor
zip build/windows_amd64.zip mmctl.exe
md5sum < build/windows_amd64.zip | cut -d ' ' -f 1 > build/windows_amd64.zip.md5.txt

Expand Down
130 changes: 65 additions & 65 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,78 @@ import (

type Client interface {
CreateChannel(channel *model.Channel) (*model.Channel, *model.Response, error)
RemoveUserFromChannel(channelId, userId string) (*model.Response, error)
GetChannelMembers(channelId string, page, perPage int, etag string) (model.ChannelMembers, *model.Response, error)
AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.Response, error)
DeleteChannel(channelId string) (*model.Response, error)
PermanentDeleteChannel(channelId string) (*model.Response, error)
MoveChannel(channelId, teamId string, force bool) (*model.Channel, *model.Response, error)
GetPublicChannelsForTeam(teamId string, page int, perPage int, etag string) ([]*model.Channel, *model.Response, error)
GetDeletedChannelsForTeam(teamId string, page int, perPage int, etag string) ([]*model.Channel, *model.Response, error)
GetPrivateChannelsForTeam(teamId string, page int, perPage int, etag string) ([]*model.Channel, *model.Response, error)
GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool, etag string) ([]*model.Channel, *model.Response, error)
RestoreChannel(channelId string) (*model.Channel, *model.Response, error)
PatchChannel(channelId string, patch *model.ChannelPatch) (*model.Channel, *model.Response, error)
GetChannelByName(channelName, teamId string, etag string) (*model.Channel, *model.Response, error)
GetChannelByNameIncludeDeleted(channelName, teamId string, etag string) (*model.Channel, *model.Response, error)
GetChannel(channelId, etag string) (*model.Channel, *model.Response, error)
GetTeam(teamId, etag string) (*model.Team, *model.Response, error)
RemoveUserFromChannel(channelID, userID string) (*model.Response, error)
GetChannelMembers(channelID string, page, perPage int, etag string) (model.ChannelMembers, *model.Response, error)
AddChannelMember(channelID, userID string) (*model.ChannelMember, *model.Response, error)
DeleteChannel(channelID string) (*model.Response, error)
PermanentDeleteChannel(channelID string) (*model.Response, error)
MoveChannel(channelID, teamID string, force bool) (*model.Channel, *model.Response, error)
GetPublicChannelsForTeam(teamID string, page int, perPage int, etag string) ([]*model.Channel, *model.Response, error)
GetDeletedChannelsForTeam(teamID string, page int, perPage int, etag string) ([]*model.Channel, *model.Response, error)
GetPrivateChannelsForTeam(teamID string, page int, perPage int, etag string) ([]*model.Channel, *model.Response, error)
GetChannelsForTeamForUser(teamID, userID string, includeDeleted bool, etag string) ([]*model.Channel, *model.Response, error)
RestoreChannel(channelID string) (*model.Channel, *model.Response, error)
PatchChannel(channelID string, patch *model.ChannelPatch) (*model.Channel, *model.Response, error)
GetChannelByName(channelName, teamID string, etag string) (*model.Channel, *model.Response, error)
GetChannelByNameIncludeDeleted(channelName, teamID string, etag string) (*model.Channel, *model.Response, error)
GetChannel(channelID, etag string) (*model.Channel, *model.Response, error)
GetTeam(teamID, etag string) (*model.Team, *model.Response, error)
GetTeamByName(name, etag string) (*model.Team, *model.Response, error)
GetAllTeams(etag string, page int, perPage int) ([]*model.Team, *model.Response, error)
CreateTeam(team *model.Team) (*model.Team, *model.Response, error)
PatchTeam(teamId string, patch *model.TeamPatch) (*model.Team, *model.Response, error)
AddTeamMember(teamId, userId string) (*model.TeamMember, *model.Response, error)
RemoveTeamMember(teamId, userId string) (*model.Response, error)
SoftDeleteTeam(teamId string) (*model.Response, error)
PermanentDeleteTeam(teamId string) (*model.Response, error)
RestoreTeam(teamId string) (*model.Team, *model.Response, error)
UpdateTeamPrivacy(teamId string, privacy string) (*model.Team, *model.Response, error)
PatchTeam(teamID string, patch *model.TeamPatch) (*model.Team, *model.Response, error)
AddTeamMember(teamID, userID string) (*model.TeamMember, *model.Response, error)
RemoveTeamMember(teamID, userID string) (*model.Response, error)
SoftDeleteTeam(teamID string) (*model.Response, error)
PermanentDeleteTeam(teamID string) (*model.Response, error)
RestoreTeam(teamID string) (*model.Team, *model.Response, error)
UpdateTeamPrivacy(teamID string, privacy string) (*model.Team, *model.Response, error)
SearchTeams(search *model.TeamSearch) ([]*model.Team, *model.Response, error)
GetPost(postId string, etag string) (*model.Post, *model.Response, error)
GetPost(postID string, etag string) (*model.Post, *model.Response, error)
CreatePost(post *model.Post) (*model.Post, *model.Response, error)
GetPostsForChannel(channelId string, page, perPage int, etag string, collapsedThreads bool) (*model.PostList, *model.Response, error)
GetPostsForChannel(channelID string, page, perPage int, etag string, collapsedThreads bool) (*model.PostList, *model.Response, error)
DoAPIPost(url string, data string) (*http.Response, error)
GetLdapGroups() ([]*model.Group, *model.Response, error)
GetGroupsByChannel(channelId string, groupOpts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.Response, error)
GetGroupsByTeam(teamId string, groupOpts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.Response, error)
GetGroupsByChannel(channelID string, groupOpts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.Response, error)
GetGroupsByTeam(teamID string, groupOpts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.Response, error)
UploadLicenseFile(data []byte) (*model.Response, error)
RemoveLicenseFile() (*model.Response, error)
GetLogs(page, perPage int) ([]string, *model.Response, error)
GetRoleByName(name string) (*model.Role, *model.Response, error)
PatchRole(roleId string, patch *model.RolePatch) (*model.Role, *model.Response, error)
PatchRole(roleID string, patch *model.RolePatch) (*model.Role, *model.Response, error)
UploadPlugin(file io.Reader) (*model.Manifest, *model.Response, error)
UploadPluginForced(file io.Reader) (*model.Manifest, *model.Response, error)
RemovePlugin(id string) (*model.Response, error)
EnablePlugin(id string) (*model.Response, error)
DisablePlugin(id string) (*model.Response, error)
GetPlugins() (*model.PluginsResponse, *model.Response, error)
GetUser(userId, etag string) (*model.User, *model.Response, error)
GetUser(userID, etag string) (*model.User, *model.Response, error)
GetUserByUsername(userName, etag string) (*model.User, *model.Response, error)
GetUserByEmail(email, etag string) (*model.User, *model.Response, error)
PermanentDeleteUser(userId string) (*model.Response, error)
PermanentDeleteUser(userID string) (*model.Response, error)
PermanentDeleteAllUsers() (*model.Response, error)
CreateUser(user *model.User) (*model.User, *model.Response, error)
VerifyUserEmailWithoutToken(userId string) (*model.User, *model.Response, error)
UpdateUserRoles(userId, roles string) (*model.Response, error)
InviteUsersToTeam(teamId string, userEmails []string) (*model.Response, error)
VerifyUserEmailWithoutToken(userID string) (*model.User, *model.Response, error)
UpdateUserRoles(userID, roles string) (*model.Response, error)
InviteUsersToTeam(teamID string, userEmails []string) (*model.Response, error)
SendPasswordResetEmail(email string) (*model.Response, error)
UpdateUser(user *model.User) (*model.User, *model.Response, error)
UpdateUserMfa(userId, code string, activate bool) (*model.Response, error)
UpdateUserPassword(userId, currentPassword, newPassword string) (*model.Response, error)
UpdateUserHashedPassword(userId, newHashedPassword string) (*model.Response, error)
CreateUserAccessToken(userId, description string) (*model.UserAccessToken, *model.Response, error)
RevokeUserAccessToken(tokenId string) (*model.Response, error)
GetUserAccessTokensForUser(userId string, page, perPage int) ([]*model.UserAccessToken, *model.Response, error)
ConvertUserToBot(userId string) (*model.Bot, *model.Response, error)
ConvertBotToUser(userId string, userPatch *model.UserPatch, setSystemAdmin bool) (*model.User, *model.Response, error)
PromoteGuestToUser(userId string) (*model.Response, error)
DemoteUserToGuest(guestId string) (*model.Response, error)
UpdateUserMfa(userID, code string, activate bool) (*model.Response, error)
UpdateUserPassword(userID, currentPassword, newPassword string) (*model.Response, error)
UpdateUserHashedPassword(userID, newHashedPassword string) (*model.Response, error)
CreateUserAccessToken(userID, description string) (*model.UserAccessToken, *model.Response, error)
RevokeUserAccessToken(tokenID string) (*model.Response, error)
GetUserAccessTokensForUser(userID string, page, perPage int) ([]*model.UserAccessToken, *model.Response, error)
ConvertUserToBot(userID string) (*model.Bot, *model.Response, error)
ConvertBotToUser(userID string, userPatch *model.UserPatch, setSystemAdmin bool) (*model.User, *model.Response, error)
PromoteGuestToUser(userID string) (*model.Response, error)
DemoteUserToGuest(guestID string) (*model.Response, error)
CreateCommand(cmd *model.Command) (*model.Command, *model.Response, error)
ListCommands(teamId string, customOnly bool) ([]*model.Command, *model.Response, error)
GetCommandById(cmdId string) (*model.Command, *model.Response, error)
ListCommands(teamID string, customOnly bool) ([]*model.Command, *model.Response, error)
GetCommandById(cmdID string) (*model.Command, *model.Response, error)
UpdateCommand(cmd *model.Command) (*model.Command, *model.Response, error)
MoveCommand(teamId string, commandId string) (*model.Response, error)
DeleteCommand(commandId string) (*model.Response, error)
MoveCommand(teamID string, commandID string) (*model.Response, error)
DeleteCommand(commandID string) (*model.Response, error)
GetConfig() (*model.Config, *model.Response, error)
UpdateConfig(*model.Config) (*model.Config, *model.Response, error)
PatchConfig(*model.Config) (*model.Config, *model.Response, error)
Expand All @@ -92,19 +92,19 @@ type Client interface {
SyncLdap(includeRemovedMembers bool) (*model.Response, error)
MigrateIdLdap(toAttribute string) (*model.Response, error)
GetUsers(page, perPage int, etag string) ([]*model.User, *model.Response, error)
GetUsersByIds(userIds []string) ([]*model.User, *model.Response, error)
GetUsersInTeam(teamId string, page, perPage int, etag string) ([]*model.User, *model.Response, error)
UpdateUserActive(userId string, activate bool) (*model.Response, error)
GetUsersByIds(userIDs []string) ([]*model.User, *model.Response, error)
GetUsersInTeam(teamID string, page, perPage int, etag string) ([]*model.User, *model.Response, error)
UpdateUserActive(userID string, activate bool) (*model.Response, error)
UpdateTeam(team *model.Team) (*model.Team, *model.Response, error)
UpdateChannelPrivacy(channelId string, privacy model.ChannelType) (*model.Channel, *model.Response, error)
UpdateChannelPrivacy(channelID string, privacy model.ChannelType) (*model.Channel, *model.Response, error)
CreateBot(bot *model.Bot) (*model.Bot, *model.Response, error)
PatchBot(userId string, patch *model.BotPatch) (*model.Bot, *model.Response, error)
PatchBot(userID string, patch *model.BotPatch) (*model.Bot, *model.Response, error)
GetBots(page, perPage int, etag string) ([]*model.Bot, *model.Response, error)
GetBotsIncludeDeleted(page, perPage int, etag string) ([]*model.Bot, *model.Response, error)
GetBotsOrphaned(page, perPage int, etag string) ([]*model.Bot, *model.Response, error)
DisableBot(botUserId string) (*model.Bot, *model.Response, error)
EnableBot(botUserId string) (*model.Bot, *model.Response, error)
AssignBot(botUserId, newOwnerId string) (*model.Bot, *model.Response, error)
DisableBot(botUserID string) (*model.Bot, *model.Response, error)
EnableBot(botUserID string) (*model.Bot, *model.Response, error)
AssignBot(botUserID, newOwnerID string) (*model.Bot, *model.Response, error)
SetServerBusy(secs int) (*model.Response, error)
ClearServerBusy() (*model.Response, error)
GetServerBusy() (*model.ServerBusyState, *model.Response, error)
Expand All @@ -117,29 +117,29 @@ type Client interface {
GetPing() (string, *model.Response, error)
GetPingWithFullServerStatus() (map[string]string, *model.Response, error)
CreateUpload(us *model.UploadSession) (*model.UploadSession, *model.Response, error)
GetUpload(uploadId string) (*model.UploadSession, *model.Response, error)
GetUploadsForUser(userId string) ([]*model.UploadSession, *model.Response, error)
UploadData(uploadId string, data io.Reader) (*model.FileInfo, *model.Response, error)
GetUpload(uploadID string) (*model.UploadSession, *model.Response, error)
GetUploadsForUser(userID string) ([]*model.UploadSession, *model.Response, error)
UploadData(uploadID string, data io.Reader) (*model.FileInfo, *model.Response, error)
ListImports() ([]string, *model.Response, error)
GetJob(id string) (*model.Job, *model.Response, error)
GetJobs(page int, perPage int) ([]*model.Job, *model.Response, error)
GetJobsByType(jobType string, page int, perPage int) ([]*model.Job, *model.Response, error)
CreateJob(job *model.Job) (*model.Job, *model.Response, error)
CancelJob(jobId string) (*model.Response, error)
CancelJob(jobID string) (*model.Response, error)
CreateIncomingWebhook(hook *model.IncomingWebhook) (*model.IncomingWebhook, *model.Response, error)
UpdateIncomingWebhook(hook *model.IncomingWebhook) (*model.IncomingWebhook, *model.Response, error)
GetIncomingWebhooks(page int, perPage int, etag string) ([]*model.IncomingWebhook, *model.Response, error)
GetIncomingWebhooksForTeam(teamId string, page int, perPage int, etag string) ([]*model.IncomingWebhook, *model.Response, error)
GetIncomingWebhooksForTeam(teamID string, page int, perPage int, etag string) ([]*model.IncomingWebhook, *model.Response, error)
GetIncomingWebhook(hookID string, etag string) (*model.IncomingWebhook, *model.Response, error)
DeleteIncomingWebhook(hookID string) (*model.Response, error)
CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.Response, error)
UpdateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.Response, error)
GetOutgoingWebhooks(page int, perPage int, etag string) ([]*model.OutgoingWebhook, *model.Response, error)
GetOutgoingWebhook(hookId string) (*model.OutgoingWebhook, *model.Response, error)
GetOutgoingWebhooksForChannel(channelId string, page int, perPage int, etag string) ([]*model.OutgoingWebhook, *model.Response, error)
GetOutgoingWebhooksForTeam(teamId string, page int, perPage int, etag string) ([]*model.OutgoingWebhook, *model.Response, error)
RegenOutgoingHookToken(hookId string) (*model.OutgoingWebhook, *model.Response, error)
DeleteOutgoingWebhook(hookId string) (*model.Response, error)
GetOutgoingWebhook(hookID string) (*model.OutgoingWebhook, *model.Response, error)
GetOutgoingWebhooksForChannel(channelID string, page int, perPage int, etag string) ([]*model.OutgoingWebhook, *model.Response, error)
GetOutgoingWebhooksForTeam(teamID string, page int, perPage int, etag string) ([]*model.OutgoingWebhook, *model.Response, error)
RegenOutgoingHookToken(hookID string) (*model.OutgoingWebhook, *model.Response, error)
DeleteOutgoingWebhook(hookID string) (*model.Response, error)
ListExports() ([]string, *model.Response, error)
DeleteExport(name string) (*model.Response, error)
DownloadExport(name string, wr io.Writer, offset int64) (int64, *model.Response, error)
Expand Down
Loading