Skip to content
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

Pin the GitHub actions we use on this repo to a full length commit SHA #10841

Closed
HonkingGoose opened this issue Jul 14, 2021 · 14 comments
Closed
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:blocked Issue is blocked by another issue or external requirement type:refactor Refactoring or improving of existing code

Comments

@HonkingGoose
Copy link
Collaborator

HonkingGoose commented Jul 14, 2021

What would you like Renovate to be able to do?

@rarkins and @viceice now that PR #10835 is merged, we can start thinking about pinning our GitHub Actions to the current full length Git commit SHA?

Did you already have any implementation ideas?

@viceice can you explain what pattern we need to follow to make things work properly?
I think you can use a comment to say what "tagged version" you're at???

As an example I've grabbed the commit to which actions/setup-node@v2.2.0 points right now.

- name: Set up Node.js ${{ env.NODE_VERSION }}
  uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f
  with:
    node-version: ${{ env.NODE_VERSION }}
    cache: yarn

Or maybe we can add a comment which says what tag we're "following".

- name: Set up Node.js ${{ env.NODE_VERSION }}
  uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # setup-node: tag=v2
  with:
    node-version: ${{ env.NODE_VERSION }}
    cache: yarn

We'll also need to update the default.json over on the renovate/.github repository, to make use of the new feature.

@HonkingGoose HonkingGoose added type:feature Feature (new functionality) status:requirements Full requirements are not yet known, so implementation should not be started priority-5-triage type:refactor Refactoring or improving of existing code and removed type:feature Feature (new functionality) labels Jul 14, 2021
@viceice
Copy link
Member

viceice commented Jul 14, 2021

  1. We need to wait for v25.56.0 to be live in hosted app ⏳
  2. We need to add helpers:pinGitHubActionDigests preset ✍️
  3. Wait for renovate to do some magic ⌛ 🧙

@viceice viceice added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:blocked Issue is blocked by another issue or external requirement and removed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Jul 14, 2021
@HonkingGoose
Copy link
Collaborator Author

I've made PRs on renovatebot/.github and on containerbase/.github to add helper:pinGitHubActionDigests to their config files.

See:

@rarkins
Copy link
Collaborator

rarkins commented Jul 15, 2021

@viceice how come we already got so many pinning PRs in this org already? Is it because we have pinDigests=true already?

@viceice
Copy link
Member

viceice commented Jul 15, 2021

i did not found any ref to pinDigests=true. i don't know what happens 🤔

@viceice
Copy link
Member

viceice commented Jul 15, 2021

on docker-rust we don't have pin updates
image

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["github>renovatebot/.github"]
}

on internal-tools we have pin updates
image

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["github>renovatebot/.github"],
  "packageRules": [
    {
      "paths": ["+(Dockerfile)"],
      "enabled": false
    },
    {
      "updateTypes": ["lockFileMaintenance"],
      "semanticCommitType": "build"
    },
    {
      "packageNames": ["renovate"],
      "extends": ["schedule:weekly"],
      "automerge": true,
      "separateMinorPatch": false
    }
  ]
}

@rarkins
Copy link
Collaborator

rarkins commented Jul 15, 2021

Those PRs caused config errors so I have reverted them. I'd love to know what's going on..

@viceice
Copy link
Member

viceice commented Jul 15, 2021

Those PRs caused config errors so I have reverted them. I'd love to know what's going on..

It was wrong preset name, there was a missing s, so right name is helpers:pinGitHubActionDigests, updated my comment above too.

But it's unclear to my. why we have pin pr's without even adding this preset. And why only in some repos. Very strange.

@HonkingGoose
Copy link
Collaborator Author

It was wrong preset name, there was a missing s, so right name is helpers:pinGitHubActionDigests, updated my comment above too.

Opened PR #10857 to fix the typo in the docs.

@HonkingGoose
Copy link
Collaborator Author

Those PRs caused config errors so I have reverted them. I'd love to know what's going on..

The config error was probably because I used the wrong name for the helpers: preset... 😉

Do you want 2 new PRs from me with the correct config, or do you want to hold off for now?

@viceice
Copy link
Member

viceice commented Jul 15, 2021

we should hold of until we know why we already got pin pr's.

@viceice
Copy link
Member

viceice commented Jul 15, 2021

Found it, github-actions assign language=docker

const language = LANGUAGE_DOCKER;

so it is assigning the docker:pinDigests preset:

pinDigests: {
description: 'Pin Docker digests',
docker: {
pinDigests: true,
},
},

here:

const language = get(manager, 'language');
if (language) {
managerConfig = mergeChildConfig(managerConfig, config[language]);
}

@viceice
Copy link
Member

viceice commented Jul 15, 2021

@HonkingGoose you can now prepare those pr's.

@HonkingGoose
Copy link
Collaborator Author

@HonkingGoose you can now prepare those pr's.

You've got new PR's! 😉

@HonkingGoose
Copy link
Collaborator Author

This issue can be closed now that we merged PR #10858 and have pinned our GitHub Actions to a full length commit SHA.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:blocked Issue is blocked by another issue or external requirement type:refactor Refactoring or improving of existing code
Projects
None yet
Development

No branches or pull requests

3 participants