Skip to content

Branch changes from Master to Main #603

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

Merged
merged 1 commit into from
Oct 17, 2022
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:
- 'README.md'
- 'SECURITY.md'
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:
build-test:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'dockerfile-image-update-') == false
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
- name: docker build
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
needs: [build-test, get-next-version]
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
- name: Download itest dir
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
needs: build-test
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
- name: Download main project dir
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: "Code scanning - action"
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md
# https://github.com/actions/labeler/blob/main/README.md
#
# Runs on `pull_request_target` to get a write token. This is safe since we're not checking
# out any arbitrary git repos.
Expand All @@ -14,7 +14,7 @@ name: "Pull Request Labeler"
on:
pull_request_target:
branches:
- master
- main

jobs:
triage:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
workflow_dispatch:
push:
branches:
- master
- main

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
if: startsWith(github.ref, 'dockerfile-image-update-') == false
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
- name: docker build
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
needs: [build-test, get-next-version]
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
- name: Download itest dir
Expand All @@ -56,10 +56,10 @@ jobs:
deploy:
needs: [ integration-test, get-next-version ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/main'
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
- name: Download main project dir
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 Lic

[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/)
[golang-coc]: https://golang.org/conduct
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
[cncf-coc]: https://github.com/cncf/foundation/blob/main/code-of-conduct.md
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![Multi-Module Maven Build / Deploy](https://github.com/salesforce/dockerfile-image-update/workflows/Multi-Module%20Maven%20Build%20/%20Deploy/badge.svg)
[![codecov](https://codecov.io/gh/salesforce/dockerfile-image-update/branch/master/graph/badge.svg)](https://codecov.io/gh/salesforce/dockerfile-image-update)
[![codecov](https://codecov.io/gh/salesforce/dockerfile-image-update/branch/main/graph/badge.svg)](https://codecov.io/gh/salesforce/dockerfile-image-update)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.salesforce.dockerfile-image-update/dockerfile-image-update/badge.svg?maxAge=3600)](https://maven-badges.herokuapp.com/maven-central/com.salesforce.dockerfile-image-update/dockerfile-image-update)
[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/salesforce/dockerfile-image-update?label=Docker%20version&sort=semver)](https://hub.docker.com/r/salesforce/dockerfile-image-update/tags)

Expand Down Expand Up @@ -129,7 +129,7 @@ named arguments:
limit the search results for github api (default: 1000)
-o ORG, --org ORG search within specific organization (default: all of github)
-b BRANCH, --branch BRANCH
make pull requests for given branch name (default: master)
make pull requests for given branch name (default: main)
-g GHAPI, --ghapi GHAPI
link to github api; overrides environment variable
-f, --auto-merge NOT IMPLEMENTED / set to automatically merge pull requests if available
Expand Down Expand Up @@ -232,7 +232,7 @@ java -jar dockerfile-image-update-1.0-SNAPSHOT.jar <COMMAND> <PARAMETERS>

### Creating a new feature

Under [dockerfile-image-update/src/main/java/com/salesforce/dva/dockerfileimageupdate/subcommands/impl](https://github.com/salesforce/dockerfile-image-update/tree/master/dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/subcommands/impl),
Under [dockerfile-image-update/src/main/java/com/salesforce/dva/dockerfileimageupdate/subcommands/impl](https://github.com/salesforce/dockerfile-image-update/tree/main/dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/subcommands/impl),
create a new class `YOUR_FEATURE.java`.
Make sure it implements `ExecutableWithNamespace` and has the `SubCommand`
annotation with a `help`, `requiredParams`, and `optionalParams`.
Expand All @@ -247,7 +247,7 @@ Run unit tests by running `mvn test`.
Before you run the integration tests (locally):

1. Make sure that you have access to the github orgs specified in
[TestCommon.ORGS](https://github.com/salesforce/dockerfile-image-update/blob/master/dockerfile-image-update-itest/src/main/java/com/salesforce/dockerfileimageupdate/itest/tests/TestCommon.java#L33).
[TestCommon.ORGS](https://github.com/salesforce/dockerfile-image-update/blob/main/dockerfile-image-update-itest/src/main/java/com/salesforce/dockerfileimageupdate/itest/tests/TestCommon.java#L33).
You likely will need to change it to three orgs where you have permissions
to create repositories.
1. Make sure you have `git_api_url=https://api.github.com` in `/dockerfile-image-update-itest/itest.env`,
Expand Down Expand Up @@ -282,7 +282,7 @@ to manually trigger the release process. For now, that looks like the following:
#### 1. Versioned Git Tag

* Decide what version you desire to have. If you want to bump the major or minor
version then you need to bump the `MVN_SNAPSHOT_VERSION` in the [Makefile](https://github.com/salesforce/dockerfile-image-update/blob/master/Makefile#L5)
version then you need to bump the `MVN_SNAPSHOT_VERSION` in the [Makefile](https://github.com/salesforce/dockerfile-image-update/blob/main/Makefile#L5)
and in the
[Dockerfile](https://github.com/salesforce/dockerfile-image-update/blob/afalko-maj-minor/Dockerfile#L4)
before proceeding to the next steps. For example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static ArgumentParser getArgumentParser() {
.help("search within specific organization (default: all of github)");
/* Currently, because of argument passing reasons, you can only specify one branch. */
parser.addArgument("-b", "--" + Constants.GIT_BRANCH)
.help("make pull requests for given branch name (default: master)");
.help("make pull requests for given branch name (default: main)");
parser.addArgument("-g", "--" + Constants.GIT_API)
.help("link to github api; overrides environment variable");
parser.addArgument("-f", "--auto-merge").action(Arguments.storeTrue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,17 @@ public void testTryRetrievingBlobException() throws IOException {
@DataProvider
public Object[][] inputBranchesImagesAndTags() {
return new Object[][] {
{"master", "image1", "image1", "6", "7", 1},
{"main", "image1", "image1", "6", "7", 1},
{"branch", "image1", "image2", "7", "7", 0},
{"master", "image1", "image1", "6", "7", 1},
{"main", "image1", "image1", "6", "7", 1},
{"branch2", "image1", "image2", "6", "7", 0},
{"master", "image1", "image1", "6", "7", 1},
{"main", "image1", "image1", "6", "7", 1},
{"branch", "image1", "image1", "7", "7", 0},
{"master", "image1", "image2", "6", "7", 0},
{"main", "image1", "image2", "6", "7", 0},
{"branch3", "image1", "image1", "6", "7", 1},
{"master", "image1", "image1", "6", "7", 1},
{"main", "image1", "image1", "6", "7", 1},
{"branch", "image1", "image1", "7", "7", 0},
{"master", "image1", "image1", "6", "7", 1},
{"main", "image1", "image1", "6", "7", 1},
{"branch5", "image1", "image1", "6", "7", 1},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,53 +85,53 @@ public void testCreatePullReq_correctCallToPullRequest() throws Exception {
GitHub github = mock(GitHub.class);
GitHubUtil gitHubUtil = new GitHubUtil(github);
GHRepository origRepo = mock(GHRepository.class);
when(origRepo.getDefaultBranch()).thenReturn("master");
when(origRepo.getDefaultBranch()).thenReturn("main");
when(origRepo.createPullRequest(any(), any(), any(), any())).thenReturn(mock(GHPullRequest.class));
GHRepository forkRepo = mock(GHRepository.class);
when(forkRepo.getOwnerName()).thenReturn("owner");
assertEquals(gitHubUtil.createPullReq(origRepo, "branch", forkRepo, "title", "body"), 0);
verify(origRepo, times(1)).createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body"));
verify(origRepo, times(1)).createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body"));
}

@Test
public void testCreatePullReq_errorCase0() throws Exception {
GitHub github = mock(GitHub.class);
GitHubUtil gitHubUtil = new GitHubUtil(github);
GHRepository origRepo = mock(GHRepository.class);
when(origRepo.getDefaultBranch()).thenReturn("master");
when(origRepo.createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body")))
when(origRepo.getDefaultBranch()).thenReturn("main");
when(origRepo.createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body")))
.thenThrow(new IOException("{\"message\":\"Validation Failed\",\"errors\":[{\"resource\":\"PullRequest\",\"code\":\"custom\",\"message\":\"A pull request already exists for someone:somebranch.\"}],\"documentation_url\":\"https://developer.github.com/enterprise/2.6/v3/pulls/#create-a-pull-request\"}"));
GHRepository forkRepo = mock(GHRepository.class);
when(forkRepo.getOwnerName()).thenReturn("owner");
assertEquals(gitHubUtil.createPullReq(origRepo, "branch", forkRepo, "title", "body"), 0);
verify(origRepo, times(1)).createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body"));
verify(origRepo, times(1)).createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body"));
}

@Test
public void testCreatePullReq_errorCase1() throws Exception {
GitHub github = mock(GitHub.class);
GitHubUtil gitHubUtil = new GitHubUtil(github);
GHRepository origRepo = mock(GHRepository.class);
when(origRepo.getDefaultBranch()).thenReturn("master");
when(origRepo.createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body")))
when(origRepo.getDefaultBranch()).thenReturn("main");
when(origRepo.createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body")))
.thenThrow(new IOException("{\"message\":\"Validation Failed\",\"errors\":[{\"resource\":\"PullRequest\",\"code\":\"custom\",\"message\":\"No commits between thisrepo and thatrepo.\"}],\"documentation_url\":\"https://developer.github.com/enterprise/2.6/v3/pulls/#create-a-pull-request\"}"));
GHRepository forkRepo = mock(GHRepository.class);
when(forkRepo.getOwnerName()).thenReturn("owner");
assertEquals(gitHubUtil.createPullReq(origRepo, "branch", forkRepo, "title", "body"), 1);
verify(origRepo, times(1)).createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body"));
verify(origRepo, times(1)).createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body"));
}
@Test
public void testCreatePullReq_errorCase1_withInvalidCode() throws Exception {
GitHub github = mock(GitHub.class);
GitHubUtil gitHubUtil = new GitHubUtil(github);
GHRepository origRepo = mock(GHRepository.class);
when(origRepo.getDefaultBranch()).thenReturn("master");
when(origRepo.createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body")))
when(origRepo.getDefaultBranch()).thenReturn("main");
when(origRepo.createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body")))
.thenThrow(new IOException("{\"message\":\"Validation Failed\",\"errors\":[{\"resource\":\"PullRequest\",\"field\":\"head\",\"code\":\"invalid\"}],\"documentation_url\":\"https://developer.github.com/enterprise/2.6/v3/pulls/#create-a-pull-request\"}"));
GHRepository forkRepo = mock(GHRepository.class);
when(forkRepo.getOwnerName()).thenReturn("owner");
assertEquals(gitHubUtil.createPullReq(origRepo, "branch", forkRepo, "title", "body"), 1);
verify(origRepo).createPullRequest(eq("title"), eq("owner:branch"), eq("master"), eq("body"));
verify(origRepo).createPullRequest(eq("title"), eq("owner:branch"), eq("main"), eq("body"));
}

@Test
Expand Down